Order Example
In the example Static Orders Request we’ve considered the variants of sending the simple trading orders using static methods of the class NewOrderRequest. At the same time we can send more complex orders among those which can be created in the Protrader platform. We can indicate the protection levels, random comment, client ID (MagicNumber), the maximum permissible slippage and etc. at once in the trading order:
// Setting the values by properties accessing var request = new NewOrderRequest(); request.Instrument = Instrument; request.Account = Account; request.Side = Operation.Buy; request.Type = OrdersType.Market; request.Price = Instrument.LastQuote.Bid; request.Amount = 1; request.TimeInForce = TimeInForce.GTC; // Setting the values during the initialization var request = new NewOrderRequest { Side = Operation.Buy, Type = OrdersType.Market, Instrument = Instrument, Account = Account, Price = Instrument.LastQuote.Bid + 20 * Instrument.TickSize, Amount = 1, TimeInForce = TimeInForce.GTC, }; // Building a new request by constructor with instrument, opearation price, stop price, type and account parameters new NewOrderRequest(Instrument, Operation.Sell, 2, Instrument.LastQuote.Ask, Instrument.LastQuote.Ask + 30 * Instrument.TickSize, OrdersType.Market, Account); // Building a new request by constructor with instrument, opearation price, stop price, type, account and TIF parameters new NewOrderRequest(Instrument, Operation.Sell, 2, Instrument.LastQuote.Ask + 30 * Instrument.TickSize, Instrument.LastQuote.Ask + 40 * Instrument.TickSize, OrdersType.Market, Account, TimeInForce.GTC); // Building a new request by constructor with a full list of parameters var request = new NewOrderRequest( Instrument, Operation.Buy, 2, Instrument.LastQuote.Ask + 40 * Instrument.TickSize, Instrument.LastQuote.Ask + 50 * Instrument.TickSize, OrdersType.Market, Account, TimeInForce.GTD, DateTime.UtcNow.AddDays(1), "My order", "-1", 20 * Instrument.TickSize, 20 * Instrument.TickSize, 20 * Instrument.TickSize, 1000, 131313);
After plotting the order, it can be sent by methods of the class Orders, for example,
Orders.Send(NewOrderRequest request)
No replies yet
Join PTMC community to post your replies on forum