Пример #1
0
        public static OrderPartiallyFilled OrderPartiallyFilledEvent(
            Order order,
            Quantity filledQuantity,
            Quantity leavesQuantity,
            Price?averagePrice = null)
        {
            if (averagePrice is null)
            {
                averagePrice = Price.Create(1.00000m);
            }

            return(new OrderPartiallyFilled(
                       AccountId.FromString("FXCM-02851908-DEMO"),
                       order.Id,
                       new ExecutionId("None"),
                       new PositionIdBroker("None"),
                       order.Symbol,
                       order.OrderSide,
                       filledQuantity,
                       leavesQuantity,
                       averagePrice,
                       Currency.USD,
                       StubZonedDateTime.UnixEpoch() + Period.FromMinutes(1).ToDuration(),
                       Guid.NewGuid(),
                       StubZonedDateTime.UnixEpoch()));
        }
Пример #2
0
 public static OrderSubmitted OrderSubmittedEvent(Order order)
 {
     return(new OrderSubmitted(
                AccountId.FromString("FXCM-02851908-DEMO"),
                order.Id,
                StubZonedDateTime.UnixEpoch(),
                Guid.NewGuid(),
                StubZonedDateTime.UnixEpoch()));
 }
Пример #3
0
 public static Bar Build()
 {
     return(new Bar(
                Price.Create(0.80000m),
                Price.Create(0.80025m),
                Price.Create(0.79980m),
                Price.Create(0.80008m),
                Quantity.Create(1000),
                StubZonedDateTime.UnixEpoch()));
 }
Пример #4
0
 public static OrderAccepted OrderAcceptedEvent(Order order)
 {
     return(new OrderAccepted(
                AccountId.FromString("FXCM-02851908-DEMO"),
                order.Id,
                new OrderIdBroker("B" + order.Id.Value),
                StubZonedDateTime.UnixEpoch(),
                Guid.NewGuid(),
                StubZonedDateTime.UnixEpoch()));
 }
Пример #5
0
 public static Bar Create(Duration offset)
 {
     return(new Bar(
                Price.Create(1.00000m),
                Price.Create(1.00000m),
                Price.Create(1.00000m),
                Price.Create(1.00000m),
                Quantity.Create(1000000),
                StubZonedDateTime.UnixEpoch() + offset));
 }
Пример #6
0
 public static Bar Create(int offsetMinutes = 0)
 {
     return(new Bar(
                Price.Create(1.00000m),
                Price.Create(1.00000m),
                Price.Create(1.00000m),
                Price.Create(1.00000m),
                Quantity.Create(1000000),
                StubZonedDateTime.UnixEpoch() + Duration.FromMinutes(offsetMinutes)));
 }
Пример #7
0
 public static OrderCancelReject OrderCancelRejectEvent(Order order)
 {
     return(new OrderCancelReject(
                AccountId.FromString("FXCM-02851908-DEMO"),
                order.Id,
                StubZonedDateTime.UnixEpoch(),
                "None",
                "TEST",
                Guid.NewGuid(),
                StubZonedDateTime.UnixEpoch()));
 }
Пример #8
0
        public StubOrderBuilder EntryOrder(string orderId)
        {
            this.Symbol      = new Symbol("AUD/USD", new Venue("FXCM"));
            this.OrderId     = new OrderId(orderId);
            this.OrderSide   = OrderSide.Buy;
            this.Quantity    = Quantity.Create(100000);
            this.Price       = Price.Create(0.80000m, 5);
            this.TimeInForce = TimeInForce.GTD;
            this.ExpireTime  = StubZonedDateTime.UnixEpoch() + Duration.FromMinutes(5);

            return(this);
        }
Пример #9
0
 public static OrderModified OrderModifiedEvent(Order order, Price newPrice)
 {
     return(new OrderModified(
                AccountId.FromString("FXCM-02851908-DEMO"),
                order.Id,
                new OrderIdBroker("B" + order.Id.Value),
                order.Quantity,
                newPrice,
                StubZonedDateTime.UnixEpoch(),
                Guid.NewGuid(),
                StubZonedDateTime.UnixEpoch()));
 }
Пример #10
0
 public static AccountStateEvent AccountStateEvent(string accountId = "FXCM-123456789-SIMULATED")
 {
     return(new AccountStateEvent(
                AccountId.FromString(accountId),
                Currency.USD,
                Money.Create(100000, Currency.USD),
                Money.Create(100000, Currency.USD),
                Money.Zero(Currency.USD),
                Money.Zero(Currency.USD),
                Money.Zero(Currency.USD),
                decimal.Zero,
                string.Empty,
                Guid.NewGuid(),
                StubZonedDateTime.UnixEpoch()));
 }
Пример #11
0
        public static Account ZeroCash()
        {
            var @event = new AccountStateEvent(
                new AccountId("IB", "123456789", "SIMULATED"),
                Currency.USD,
                Money.Zero(Currency.USD),
                Money.Zero(Currency.USD),
                Money.Zero(Currency.USD),
                Money.Zero(Currency.USD),
                Money.Zero(Currency.USD),
                decimal.Zero,
                string.Empty,
                Guid.NewGuid(),
                StubZonedDateTime.UnixEpoch());

            return(new Account(@event));
        }
Пример #12
0
        public static ForexInstrument USDJPY()
        {
            var instrument = new ForexInstrument(
                new Symbol("USD/JPY", new Venue("FXCM")),
                3,
                0,
                0,
                0,
                0,
                0,
                Price.Create(0.001m, 3),
                Quantity.Create(1000m),
                Quantity.Create(1m),
                Quantity.Create(50000000m),
                1,
                1,
                StubZonedDateTime.UnixEpoch());

            return(instrument);
        }
Пример #13
0
        public static ForexInstrument EURUSD()
        {
            var instrument = new ForexInstrument(
                new Symbol("EUR/USD", new Venue("FXCM")),
                5,
                0,
                0,
                0,
                0,
                0,
                Price.Create(0.00001m, 5),
                Quantity.Create(1000m),
                Quantity.Create(1m),
                Quantity.Create(50000000m),
                1,
                1,
                StubZonedDateTime.UnixEpoch());

            return(instrument);
        }
Пример #14
0
        public static OrderWorking OrderWorkingEvent(Order order, Price?workingPrice = null)
        {
            if (workingPrice is null)
            {
                workingPrice = Price.Create(1.00000m);
            }

            return(new OrderWorking(
                       AccountId.FromString("FXCM-02851908-DEMO"),
                       order.Id,
                       new OrderIdBroker("B" + order.Id.Value),
                       order.Symbol,
                       order.OrderSide,
                       order.OrderType,
                       order.Quantity,
                       workingPrice,
                       order.TimeInForce,
                       StubZonedDateTime.UnixEpoch() + Period.FromMinutes(5).ToDuration(),
                       StubZonedDateTime.UnixEpoch(),
                       Guid.NewGuid(),
                       StubZonedDateTime.UnixEpoch()));
        }
Пример #15
0
 public static IList <Bar> BuildList()
 {
     return(new List <Bar>
     {
         new Bar(Price.Create(0.80000m), Price.Create(0.80010m), Price.Create(0.80000m), Price.Create(0.80008m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(45).ToDuration()),
         new Bar(Price.Create(0.80008m), Price.Create(0.80020m), Price.Create(0.80005m), Price.Create(0.80015m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(40).ToDuration()),
         new Bar(Price.Create(0.80015m), Price.Create(0.80030m), Price.Create(0.80010m), Price.Create(0.80020m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(35).ToDuration()),
         new Bar(Price.Create(0.80020m), Price.Create(0.80030m), Price.Create(0.80000m), Price.Create(0.80010m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(30).ToDuration()),
         new Bar(Price.Create(0.80010m), Price.Create(0.80015m), Price.Create(0.79990m), Price.Create(0.79995m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(25).ToDuration()),
         new Bar(Price.Create(0.79995m), Price.Create(0.80000m), Price.Create(0.79980m), Price.Create(0.79985m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(20).ToDuration()),
         new Bar(Price.Create(0.80000m), Price.Create(0.80010m), Price.Create(0.80000m), Price.Create(0.80008m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(15).ToDuration()),
         new Bar(Price.Create(0.80000m), Price.Create(0.80010m), Price.Create(0.80000m), Price.Create(0.80008m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(10).ToDuration()),
         new Bar(Price.Create(0.80000m), Price.Create(0.80010m), Price.Create(0.80000m), Price.Create(0.80008m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch() - Period.FromMinutes(05).ToDuration()),
         new Bar(Price.Create(0.80000m), Price.Create(0.80015m), Price.Create(0.79990m), Price.Create(0.80005m), Quantity.Create(1000), StubZonedDateTime.UnixEpoch()),
     });
 }