Exemplo n.º 1
0
        private bool IsOrderDataCorrect(string instrument, decimal price, EnmOrderDir dir, decimal amount)
        {
            if (price <= 0)
            {
                Error("Incorrect price in trader order. BotId=" + BotId);
                return(false);
            }

            if (dir != EnmOrderDir.Buy && dir != EnmOrderDir.Sell)
            {
                Error("Incrorrect order dir from  trader.");
                return(false);
            }

            if (amount <= 0)
            {
                Error("Incorrect amount in trader order. BotId=" + BotId);
                return(false);
            }

            if (instrument == "")
            {
                Error("Null instrument in trader order. BotId=" + BotId);
                return(false);
            }


            return(true);
        }
        //deprecated brunch remove if not need
        public void Update(string instrument, decimal price, EnmOrderDir dir,
                           int amount, long extId,
                           DateTime moment,
                           long mtsCreate,
                           decimal fee)
        {
            CRawUserDeal rd = new CRawUserDeal
            {
                Instrument  = instrument,
                Amount      = amount,
                Dir         = (sbyte)dir,
                Ext_id_buy  = dir == EnmOrderDir.Buy ? extId : 0,
                Ext_id_sell = dir == EnmOrderDir.Sell ? extId : 0,
                Price       = price,
                ReplId      = GetBotDealId(extId, mtsCreate),
                Moment      = moment,
                Fee_buy     = 0,
                Fee_sell    = 0
            };

            //TODO chek if we already processed deal

            CalculateBotsPos(rd, isOnlineASTSCalc: true);

            UserDealsPosBoxClient.UpdateGUIDealCollection(rd);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Specific  AddOrder Method - specialy when order added by Trader
        /// (from TradersDispatcher). The main change comparing with
        /// CBotBase.AddOrder method  is: if condition false
        /// do not disable bot just do not pass the order to dealing server.
        /// </summary>
        /// <param name="instrument"></param>
        /// <param name="price"></param>
        /// <param name="dir"></param>
        /// <param name="amount"></param>
        /// <param name="botId"></param>
        /// <returns></returns>
        protected override bool AddOrder(string instrument, decimal price, EnmOrderDir dir, decimal amount, int botId)
        {
            //TODO make logic together with CBotBase in common method

            if (IsPossibleToAddOrder(instrument, price))
            {
                if (IsEnoughMoneyToAddOrder(price, amount, dir))
                {
                    _dealingServer.AddOrder(botId, instrument, price, dir, Math.Abs(amount));
                    LogAddOrder("CBotTrader.AddOrder", instrument, price, dir, amount);
                    m_currOrderSentCountTotal++;
                    if (!m_dictSentOrderCount.ContainsKey(instrument))
                    {
                        m_dictSentOrderCount[instrument] = 0;
                    }

                    m_dictSentOrderCount[instrument]++;
                    m_timers["WaitAddOrderReply"].Set();
                    return(true);
                }
            }


            Error("CBotTrader not possible to AddOrder");


            return(false);
        }
        public void AddOrder(int botId, string instrument, EnmOrderDir dir, decimal amount, decimal price)
        {
            try
            {
                decimal amountUse = (dir == EnmOrderDir.Buy) ?  amount :   -amount;

                RequestNewOrder newOrd = new RequestNewOrder(gid: botId,
                                                             cid: GenUniqueId(botId),
                                                             symbol: instrument,
                                                             type: EnmBfxOrderType.Limit,
                                                             amount: amountUse,
                                                             price:  price);

                //var serNewOrd = JsonConvert.SerializeObject(newOrd, Formatting.Indented, new RequestNewOrderConverterter());
                var serNewOrd = JsonConvert.SerializeObject(newOrd, CBitfinexJsonSerializer.Settings);
                //var serNewOrd = CBitfinexJsonSerializer.SerializeObject(newOrd);


                SendMessage(serNewOrd);

                Log(String.Format("[ADD ORDER] ==> botId={0} instrument={1} dir={2} amount={3} price={4}",
                                  botId,
                                  instrument,
                                  dir,
                                  amount,
                                  price));
            }
            catch (Exception e)
            {
                Error("CBitfenixWebScokConnector.AddOrder", e);
            }
        }
Exemplo n.º 5
0
        private void ButtonMarketOrder_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string      instrument = "";
                decimal     amount     = 0;
                CBotBase    bot        = null;
                EnmOrderDir dir        = EnmOrderDir.Buy;

                if (IsValidInput(
                        ComboMarketOrder,
                        ComboInstrumentMarketOrder,
                        TextBoxMarketOrderLot,
                        ref dir,
                        ref instrument,
                        ref amount,
                        ref bot
                        ))
                {
                    bot.ForceAddMarketOrder(instrument, dir, amount, bot.BotId);
                    ShowMessageOK();
                }
                else
                {
                    return;
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("ButtonMarketOrder_Click");
            }
        }
        private void SendThrowOrder(Key key)
        {
            if (IsModeKeyboardTrading)
            {
                EnmOrderDir dir = (key == Key.Up) ? EnmOrderDir.Buy : EnmOrderDir.Sell;

                ExecuteCommand(EventsViewModel.CmdSendOrderThrow, dir);
            }
        }
        public override void AddOrder(int botId, string instrument, decimal price, EnmOrderDir dir, decimal amount)
        {
            //int decVolume = GetDecimalVolume(instrument);
            //decimal decAmount = CUtilConv.GetDecimalVolume(amount, decVolume);

            //TODO normal
            string instrumentUse = "t" + instrument;

            //temporary disabled
            _bfxWebSockConnector.AddOrder(botId, instrumentUse, dir, amount, price);
        }
Exemplo n.º 8
0
        public void  SendOrderThrowByTrader(string instrument, EnmOrderDir dir, decimal amount, int throwSteps)
        {
            if (IsAllowTraderActions(instrument))
            {
                decimal offsetPrice = GetPriceWithOffset(instrument, dir, throwSteps);


                base.SendOrderThrow(instrument, dir, amount, offsetPrice);
                _subBots[instrument].OnSendOrderThrow(offsetPrice, amount, dir);
            }
        }
Exemplo n.º 9
0
 private bool IsShortDisabled(string instrument, EnmOrderDir dir, decimal amountOrdersToAdd)
 {
     if (!_subBots.ContainsKey(instrument))
     {
         return(false);
     }
     else
     {
         return(_subBots[instrument].IsShortDisabled(dir, amountOrdersToAdd));
     }
 }
        /// <summary>
        /// On update deal.
        ///
        /// Call from:
        /// 1) CCryptoDealingServer.UpdateUserDeals - when "te" recieved
        /// 2) CCryptoDealingServer.UpdateUserDeals - when "tu" recieved
        ///
        /// </summary>

        public void Update(long dealId, long orderId, string instrument, EnmOrderDir dir,
                           decimal amount, int botId, decimal price, DateTime moment,
                           long mtsCreate, decimal fee)
        {
            Log(string.Format("[Update] botId={0} dealId={1} orderId={2} instrument={3} dir={4} amount={5} price={6} moment={7} mtsCreate={8} fee={9})",
                              botId,      //0
                              dealId,     //1
                              orderId,    //2
                              instrument, //3
                              dir,        //4
                              amount,     //5
                              price,      //6
                              moment,     //7
                              mtsCreate,  //8
                              fee         //9
                              ));

            CRawUserDeal rd = new CRawUserDeal
            {
                Id_Deal     = dealId,
                Instrument  = instrument,
                Amount      = Math.Abs(amount),
                Dir         = (sbyte)dir,
                Ext_id_buy  = dir == EnmOrderDir.Buy ? botId : 0,
                Ext_id_sell = dir == EnmOrderDir.Sell ? botId : 0,
                Price       = price,
                ReplId      = GetBotDealId(botId, mtsCreate),
                Moment      = moment,
                Fee_buy     = dir == EnmOrderDir.Buy ? Math.Abs(fee) : 0,
                Fee_sell    = dir == EnmOrderDir.Sell ? Math.Abs(fee) : 0
            };


            CalculateBotsPos(rd, isOnlineASTSCalc: true);

            //2018-05-24
            //In case we recieve fee data in deal
            //do trigger fee calculation. This is
            //seldom case, when we where not able to process
            //"Update" deal from "te" (because orderId-botId recieved later).
            //and process deal from "tu"
            //Usually we recieve "te" with no fee, and then "tu" with fee
            if (fee != 0)
            {
                Log("Update fee from [Update]");

                //2018-06-16 TODO remove all orderdir to dealDir
                UpdateFee(botId, instrument, dealId, Math.Abs(fee), (EnmDealDir)dir);
            }


            UserDealsPosBoxClient.UpdateGUIDealCollection(rd);
        }
Exemplo n.º 11
0
        private void ButtonLimitOrder_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string      instrument = "";
                decimal     amount     = 0;
                CBotBase    bot        = null;
                EnmOrderDir dir        = EnmOrderDir.Buy;

                if (IsValidInput(
                        ComboBoxLimitOrder,
                        ComboInstrumentLimitOrder,
                        TextBoxLimOrderLot,
                        ref dir,
                        ref instrument,
                        ref amount,
                        ref bot
                        ))
                {
                    if (TextBoxPrice.Text == null ||
                        TextBoxPrice.Text == "")
                    {
                        MessageBox.Show("Ошибка. Цена не задана");
                        return;
                    }
                    else
                    {
                        decimal price;
                        try
                        {
                            price = Convert.ToDecimal(TextBoxPrice.Text);
                        }
                        catch (Exception excpt)
                        {
                            MessageBox.Show("Ошибка. Некорректная цена");
                            return;
                        }


                        bot.ForceAddOrder(instrument, price, dir, amount);
                        ShowMessageOK();
                    }
                }
                else
                {
                    return;
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("ButtonLimitOrder_Click");
            }
        }
Exemplo n.º 12
0
 public CCommandAddOrder(uint userId, string broker_code, string isin, string client_code, OrderTypes type, /*OrderDirection*/ EnmOrderDir dir, int amount, string price, int ext_id)
 {
     UserId      = userId;
     Broker_code = broker_code;
     Isin        = isin;
     Client_code = client_code;
     Type        = type;
     Dir         = dir;
     Amount      = amount;
     Price       = price;
     Ext_id      = ext_id;
 }
Exemplo n.º 13
0
        public void OnSendOrderThrow(decimal priceThrow, decimal amountThrow, EnmOrderDir dir)
        {
            SetState(EnmTraderState._0117_WaitOrderThrow);
            _timerWaitThrowOrders.Start();
            Log("OnSendOrderThrow");
            _orderThrowData.PosPrev = GetPositionCurr();
            _orderThrowData.Price   = priceThrow;
            _orderThrowData.Amount  = amountThrow;

            _orderThrowData.Dir = dir;

            Log("Before send PosPrev.Amount.amount=" + _orderThrowData.PosPrev.Amount +
                " priceThrow=" + priceThrow + " dir=" + dir + " amountThrow=" + amountThrow);
        }
Exemplo n.º 14
0
        public void SendOrderThrow(int conId, string instrument, decimal amount, EnmOrderDir dir, int throwSteps)
        {
            enmTradingEvent ev = enmTradingEvent.SendOrderThrow;

            CSendOrderThrow sot = new CSendOrderThrow
            {
                Instrument = instrument,
                OrderDir   = dir,
                Amount     = amount,
                ThrowSteps = throwSteps
            };

            SendDataToServer(conId, sot, ev);
        }
        /// <summary>
        /// Calling on "te" (TradeExecute) bifinex events.
        /// Ask UserOrderBoxCrypto to get botId based on OrderId.
        /// If BotId found -do call Update if not do save to
        /// _lstNotProcessedDeals for using this data later.
        ///
        ///
        /// Call from CBitfinexWebSockConnector.ProcessUserTradeExecute
        /// </summary>
        /// <param name="rt"></param>
        public void UpdateUserDeals(ResponseTrades rt)
        {
            Log("[UpdateUserDeals] " + rt.ToString());

            EnmOrderDir dir = rt.ExecAmount > 0 ? EnmOrderDir.Buy : EnmOrderDir.Sell;

            string instrument = rt.Pair.Remove(0, 1); //remove 't'
                                                      //long iAmount = CUtilConv.GetIntVolume(Convert.ToDecimal(rt.ExecAmount), GetDecimalVolume(instrument));
            decimal  dcmlAmount = Convert.ToDecimal(rt.ExecAmount);
            DateTime moment     = CUtilTime.DateTimeFromUnixTimestampMillis(rt.MtsCreate);

            int botId = _userOrderBoxCrypto.GetBotIdOfOrder(instrument, rt.OrderId);

            if (botId > 0) //botId found
            {
                Log("[UpdateUserDeals] botId=" + botId);
                _userDealsPosBoxCrypto.Update(rt.Id,
                                              rt.OrderId,
                                              instrument,
                                              dir,
                                              dcmlAmount,
                                              botId,
                                              Convert.ToDecimal(rt.ExecPrice),
                                              moment,
                                              rt.MtsCreate,
                                              (decimal)rt.Fee);

                //2018-06-13 common situation - remember that no fee
                //to remove it if fee will be recieved and get from rest if not
                if ((decimal)rt.Fee == 0)
                {
                    lock (_lstDealsWithNoFee)
                        _lstDealsWithNoFee.Add(rt);
                }
            }
            else //botId not found
            {
                //Write error for now (debugging). In the future - remove error msg.
                Error("UpdateUserDeals. Bot id not found");
                //Put to list of deals to process it later (on "tu")
                _lstNotProcessedDeals.Add(rt);

                //add 2018-05-24
                AddDealNoBotId(rt);
                // _lstDealsNoBotId.Add(rt);
            }
        }
Exemplo n.º 16
0
        private decimal GetUserOrderAmountByDir(EnmOrderDir dir)
        {
            decimal count = 0;

            lock (_userOrdersMon)
            {
                if (_userOrdersMon.ContainsKey(dir))
                {
                    foreach (var kvp in _userOrdersMon[dir])
                    {
                        count += kvp.Value;
                    }
                }
            }

            return(count);
        }
Exemplo n.º 17
0
        public void AddOrder(string isin, decimal amount, EnmOrderDir dir, decimal price)

        {
            int id = Convert.ToInt16(_kernelTerminal.TerminalConfig.User);

            CAddOrder ord = new CAddOrder {
                IdTrader = id, Amount = amount, Dir = dir, Isin = _tickerName, Price = price
            };

            enmTradingEvent ev = enmTradingEvent.AddOrder;


            _kernelTerminal.Communicator.SendDataToServer(ConnId, ord, ev);


            Log("AddOrder IdTrader=" + id + " Amount=" + amount + " Dir=" + dir + " isin=" + _tickerName + " price=" + price);
        }
Exemplo n.º 18
0
        /// <summary>
        ///  Get total amount of orders by price and direction
        /// </summary>
        private decimal GetUserOrderAmount(EnmOrderDir dir, decimal price)
        {
            lock (_userOrdersMon)
            {
                if (!_userOrdersMon.ContainsKey(dir))
                {
                    return(0);
                }

                if (!_userOrdersMon[dir].ContainsKey(price))
                {
                    return(0);
                }

                return(_userOrdersMon[dir][price]);
            }
        }
Exemplo n.º 19
0
        public void AddOrderRest(decimal price, EnmOrderDir dir)
        {
            CBotPos bp         = GetPositionCurr();
            decimal amountNeed = 0;

            if ((dir == EnmOrderDir.Buy && bp.Amount < 0) ||
                (dir == EnmOrderDir.Sell && bp.Amount > 0))

            {
                amountNeed = Math.Abs(bp.Amount);
                if (amountNeed > 0)
                {
                    _operations.AddOrder(_instrument, price, dir, amountNeed);
                    Log(String.Format("Order rest added price={0} amount={1} dir={2}",
                                      price, amountNeed, dir.ToString()));
                }
            }
        }
Exemplo n.º 20
0
        public void IncreasePosToMinPossible()
        {
            EnmOrderDir dir    = _positionCurr.Amount > 0 ? EnmOrderDir.Buy : EnmOrderDir.Sell;
            decimal     amount = _client.GetMinOrderSize(_instrument);

            if (_positionCurr.Amount > 0)
            {
                _expAmntAftInc = _positionCurr.Amount + amount;
            }
            else
            {
                _expAmntAftInc = _positionCurr.Amount - amount;
            }


            _client.AddMarketOrder(_instrument, dir, amount);
            SetState(EnmTraderState._0119_WaitForPosInc);
            Log(String.Format("IncreasePosToMinPossible amount={0} _expectedAmount={1}",
                              _positionCurr.Amount, _expAmntAftInc));
        }
        public void AddMarketOrder(int botId, string instrument, EnmOrderDir dir, decimal amount, decimal price)
        {
            decimal amountUse = (dir == EnmOrderDir.Buy) ? amount : -amount;

            RequestNewOrder newOrd = new RequestNewOrder(gid: botId,
                                                         cid: GenUniqueId(botId),
                                                         symbol: instrument,
                                                         type: EnmBfxOrderType.Market,
                                                         amount: amountUse,
                                                         price: price);


            newOrd.Close = 1;

            var serNewOrd = JsonConvert.SerializeObject(newOrd, CBitfinexJsonSerializer.Settings);


            SendMessage(serNewOrd);

            Log(String.Format("[ADD ORDER] ==> {0} dir={1} amount={2} price={3}", instrument, dir, amount, price));
        }
Exemplo n.º 22
0
        //TODO remove supervisorID
        public override void AddOrder(int botId, string isin, decimal price, EnmOrderDir dir, decimal dcmlAmount)
        {
            int iAmount         = Convert.ToInt32(dcmlAmount);
            CCommandStucture cs = new CCommandStucture();

            cs.CommandName = "FutAddOrder";

            cs.Command = (object)new CCommandAddOrder(1, Broker_code, isin, Client_code, OrderTypes.Part, dir, iAmount, price.ToString(), botId);
            //m_connOrderControl.CommandQueue.Add(cs);
            int connId = 0;

            /*if (supervisorID == 0)*/
            connId = botId;

            /*else
             *  connId = supervisorID;
             */
            m_dictConnOrderControl[connId].CommandQueue.Add(cs);

            Log("Add new order dir=" + dir + " amount=" + dcmlAmount + " price=" + price + " botId=" + botId);
        }
Exemplo n.º 23
0
        public void AddOrder(int botId, string instrument, decimal price, EnmOrderDir dir, decimal amount)
        {
            IDictionary <string, object> dict = new Dictionary <string, object>();

            dict["ACCOUNT"]    = _account;
            dict["QUANTITY"]   = amount;
            dict["SECBOARD"]   = _secBoard;
            dict["SECCODE"]    = instrument;
            dict["BUYSELL"]    = CTradeConv.OrderDirToChar(dir);
            dict["MKTLIMIT"]   = 'L';
            dict["SPLITFLAG"]  = 'S'; //O - only th same price, S - could be different price
            dict["PRICE"]      = price;
            dict["HIDDEN"]     = 0;
            dict["CLIENTCODE"] = _clientCode;
            dict["EXTREF"]     = botId.ToString();


            //bool res = _client.Execute("ORDER", dict, out rep);

            ExecTransaction("ORDER", dict);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Called from CTradersDispatcher when order command recieved
        ///
        /// Contains extra check methods - specific for trader.
        /// </summary>
        /// <param name="isin"></param>
        /// <param name="price"></param>
        /// <param name="dir"></param>
        /// <param name="amount"></param>
        /// <returns></returns>
        public bool AddOrderByTrader(string isin, decimal price, EnmOrderDir dir, decimal amount)
        {
            Log("Try add order by trader");
            if (IsAllowTraderActions(isin) &&          //denied for instrument (time disabled or short pos vialated disabled)
                !IsShortDisabled(isin, dir, amount) && //short is disable at the moment
                !DisabledBot &&
                //2017-11-28
                IsOrderDataCorrect(isin, price, dir, amount) //check if not null etc
                )
            {
                //2017-11-29 changed. When trader adding
                // order. Use Method of CBotTrader class which is not disable order.
                //return base.AddOrder(isin, price, dir, amount, BotId);
                return(AddOrder(isin, price, dir, amount, BotId));
            }
            else
            {
                Log("Add order by trader is not allowed");
                return(false);
            }

            //return false;
        }
Exemplo n.º 25
0
        public decimal GetBestPice(string isin, EnmOrderDir ordDir)
        {
            decimal val = 0;

            try
            {
                {
                    if (EnmOrderDir.Buy == ordDir)
                    {
                        val = m_stocksStructDict[isin].StockConverter.GetBid();
                    }
                    else
                    {
                        val = m_stocksStructDict[isin].StockConverter.GetAsk();
                    }
                }
            }
            catch (Exception e)
            {
                Error("GetBestPice", e);
            }

            return(val);
        }
Exemplo n.º 26
0
        public decimal GetBestPice(string instrument, EnmOrderDir ordDir)
        {
            decimal val = 0;

            try
            {
                {
                    if (EnmOrderDir.Buy == ordDir)
                    {
                        val = _dictStockConverter[instrument].GetBid();
                    }
                    else
                    {
                        val = _dictStockConverter[instrument].GetAsk();
                    }
                }
            }
            catch (Exception e)
            {
                Error("GetBestPice", e);
            }

            return(val);
        }
Exemplo n.º 27
0
        public bool IsShortDisabled(EnmOrderDir dir, decimal amountOrdersToAdd)
        {
            if (!_modeDisableTraderShortTrading)
            {
                return(false);
            }

            if (EnmOrderDir.Buy == dir)
            {
                return(false); //any buy orders are possible
            }
            CBotPos bp        = GetPositionCurr();
            decimal amountPos = bp.Amount;
            decimal amountExistingShortOrders = GetUserOrderAmountByDir(dir);

            if (amountPos >= amountExistingShortOrders + amountOrdersToAdd)
            {
                return(false);
            }


            Log("IsShortDisabled.");
            return(true);
        }
        /// <summary>
        /// Call when:
        ///
        /// Trade update  message triggered. Possible two cases:
        ///
        /// 1) When we've not recieved trade execute message - do full update
        /// 2) When we already recieved Trade execute message (TE) - just update fee
        ///
        /// Call from:
        ///
        /// CBitfinexWeebSockConnector.ProcessUserTradeUpdate
        ///
        ///
        /// </summary>
        /// <param name="rt"></param>
        public void UpdateUserDealsLateUpd(ResponseTrades rt)
        {
            Log("[UpdateUserDealsLateUpd] " + rt.ToString());
            EnmOrderDir dir     = rt.ExecAmount > 0 ? EnmOrderDir.Buy : EnmOrderDir.Sell; //TODO change to deal dir
            EnmDealDir  dealDir = rt.ExecAmount > 0 ? EnmDealDir.Buy : EnmDealDir.Sell;   //TODO change to deal dir

            string   instrument = rt.Pair.Remove(0, 1);                                   //remove 't'
            decimal  dcmlAmount = Convert.ToDecimal(rt.ExecAmount);
            DateTime moment     = CUtilTime.DateTimeFromUnixTimestampMillis(rt.MtsCreate);

            int botId = _userOrderBoxCrypto.GetBotIdOfOrder(instrument, rt.OrderId);

            //fee recieved no worry about "no fee" deals
            if (rt.Fee != 0)
            {
                lock (_lstDealsWithNoFee)
                {
                    _lstDealsWithNoFee.RemoveAll(el => el.Id == rt.Id);
                }
            }

            //if deal is not processed by "trade execute message" yet -
            //do full update.

            bool bNotProcessedYet = (_lstNotProcessedDeals.Find(el => el.Id == rt.Id) != null);

            //Deal was not processed yet - do full update
            if (bNotProcessedYet)
            {
                if (botId > 0) //botId found
                {
                    Log("[UpdateUserDealsLateUpd]. First processing deal. botId=" + botId);
                    _userDealsPosBoxCrypto.Update(rt.Id,
                                                  rt.OrderId,
                                                  instrument,
                                                  dir,
                                                  dcmlAmount,
                                                  botId,
                                                  Convert.ToDecimal(rt.ExecPrice),
                                                  moment,
                                                  rt.MtsCreate,
                                                  (decimal)rt.Fee);

                    //deal processed no need update it - do remove
                    _lstNotProcessedDeals.RemoveAll(el => el.Id == rt.Id);
                }
                else //botId not found - now having a REAL problem
                {
                    Error("CAUTION ! UpdateUserDealsLateUpd. BotId not found !");
                    //2018-05-14 remember deals with no botId for future processing
                    //2018-05-24 refact to funct
                    AddDealNoBotId(rt);
                }
            }
            //if deal has already  processed by "trade execute message" just update fee data
            else
            {
                Log("[UpdateUserDealsLateUpd] Update fee");
                _userDealsPosBoxCrypto.UpdateFee(botId,
                                                 instrument,
                                                 rt.Id,
                                                 Math.Abs(Convert.ToDecimal(rt.Fee)),
                                                 dealDir
                                                 );
                //TODO update fee if order if not found
            }
        }
 //deprecated brunch remove if not need
 public void UpdateDealsPos(string instrument, decimal price, EnmOrderDir dir,
                            int amount, long extId,
                            DateTime moment, long mtsCreate, decimal fee)
 {
     _userDealsPosBoxCrypto.Update(instrument, price, dir, amount, extId, moment, mtsCreate, fee);
 }
Exemplo n.º 30
0
 public static char OrderDirToChar(EnmOrderDir dir)
 {
     return(dir == EnmOrderDir.Buy ? 'B' : 'S');
 }