/// <summary>
 ///
 /// </summary>
 /// <param name="symbol">market name</param>
 /// <param name="side">buy or sell</param>
 /// <param name="price"></param>
 /// <param name="type">limit or market</param>
 /// <param name="size"></param>
 /// <param name="reduceOnly">should only reduce position amount</param>
 /// <param name="ioc">immediate or cancel</param>
 /// <param name="postOnly">will be only maker</param>
 /// <param name="clientId">optional clients order id</param>
 public FtxBasePlaceOrderRequest(string symbol, FtxOrderSide side, FtxOrderType type, decimal size, bool reduceOnly = false, string clientId = null)
 {
     Symbol     = symbol ?? throw new ArgumentNullException(nameof(symbol));
     Side       = side;
     Type       = type;
     Size       = size;
     ReduceOnly = reduceOnly;
     ClientId   = clientId;
 }
Exemple #2
0
 public static IFtxPlaceOrderReqest CreatePassiveLimitOrder(string symbol, FtxOrderSide side, decimal size, decimal price, string clOrderId = null, bool reduceOnly = false, bool ioc = false)
 {
     return(new FtxPlaceSimpleOrderRequest(symbol: symbol,
                                           side: side,
                                           type: FtxOrderType.Limit,
                                           size: size,
                                           price: price,
                                           reduceOnly: reduceOnly,
                                           clientId: clOrderId,
                                           postOnly: true,
                                           ioc: ioc));
 }
Exemple #3
0
 public FtxPlaceSimpleOrderRequest(string symbol,
                                   FtxOrderSide side,
                                   FtxOrderType type,
                                   decimal size,
                                   decimal?price   = null,
                                   bool reduceOnly = false,
                                   bool ioc        = false,
                                   bool postOnly   = false,
                                   string clientId = null)
     : base(symbol, side, type, size, reduceOnly, clientId)
 {
     if (type == FtxOrderType.Stop || type == FtxOrderType.TakeProfit || type == FtxOrderType.TrailingStop)
     {
         throw new Exception("Simple order can be only Limit or Market");
     }
     Ioc      = ioc;
     PostOnly = postOnly;
     Price    = price;
 }
Exemple #4
0
 public static IFtxPlaceOrderReqest CreateSimpleMarketOrder(string symbol, FtxOrderSide side, decimal size, string clOrderId = null, bool reduceOnly = false)
 {
     return(new FtxPlaceSimpleOrderRequest(symbol, side, FtxOrderType.Market, size, null, reduceOnly, clientId: clOrderId));
 }
Exemple #5
0
 public static IFtxPlaceOrderReqest CreateTrailingStopOrder(string symbol, FtxOrderSide side, decimal size, decimal trailValue, string clOrderId = null, bool reduceOnly = false)
 {
     return(new FtxPlaceTrailingOrderRequest(symbol, side, size, trailValue, reduceOnly, clOrderId));
 }
Exemple #6
0
 public static IFtxPlaceOrderReqest CreateStopOrder(string symbol, FtxOrderSide side, decimal size, decimal triggerPrice, decimal?limitPrice = null, string clOrderId = null, bool reduceOnly = false)
 {
     return(new FtxPlaceStopOrTakeOrderRequest(symbol, true, side, size, triggerPrice, limitPrice, reduceOnly, clOrderId));
 }
Exemple #7
0
 /// <summary>
 /// Use it to place Stop or Take orders
 /// </summary>
 /// <param name="market">symbol</param>
 /// <param name="isStop">is true, it will be stop order instead take</param>
 /// <param name="side"></param>
 /// <param name="size"></param>
 /// <param name="triggerPrice"></param>
 /// <param name="limitPrice">if it not null, stop or take order will be limit instead market</param>
 /// <param name="reduceOnly"></param>
 public FtxPlaceStopOrTakeOrderRequest(string market, bool isStop, FtxOrderSide side, decimal size, decimal triggerPrice, decimal?limitPrice = null, bool reduceOnly = false, string clientOrderId = null) : base(market, side, isStop ? FtxOrderType.Stop : FtxOrderType.TakeProfit, size, reduceOnly, clientOrderId)
 {
     TriggerPrice = triggerPrice;
     LimitPrice   = limitPrice;
 }
Exemple #8
0
 /// <summary>
 /// Use it to place trailing stop order
 /// </summary>
 /// <param name="market"></param>
 /// <param name="side"></param>
 /// <param name="size"></param>
 /// <param name="trailingValue">negative for "sell"; positive for "buy"</param>
 /// <param name="reduceOnly"></param>
 public FtxPlaceTrailingOrderRequest(string market, FtxOrderSide side, decimal size, decimal trailingValue, bool reduceOnly = false, string clientOrderId = null)
     : base(market, side, FtxOrderType.TrailingStop, size, reduceOnly, clientOrderId)
 {
     TrailValue = trailingValue;
 }