Esempio n. 1
0
        private void InfoClient_OnInfoHolding(InfoHolding holding)
        {
            if (!accounts.ContainsKey(holding.account))
            {
                return;
            }

            var code       = holding.security + "|BRD-NORMAL";
            var instrument = connector.ResolveSymbolAsync(code).Result;

            if (instrument == null)
            {
                Logger.Error().Print($"Unable to resolve instrument for {code}");
                return;
            }

            if (!mapAccountIdToAccount.ContainsKey(holding.acc_id))
            {
                mapAccountIdToAccount.Add(holding.acc_id, accounts[holding.account]);
            }

            var position = new PositionMessage
            {
                Account    = holding.account,
                Instrument = instrument,
                Quantity   = (int)holding.trade_buy_qty - (int)holding.trade_sell_qty,
                Price      = PriceHelper.ToPrice(holding.settle_price)
            };

            OnMessageReceived(position);
        }
Esempio n. 2
0
        private InstrumentParams CreateParams(InfoSecboard secboard)
        {
            var instrument = connector.ResolveSymbolAsync(secboard.code).Result;

            if (instrument == null)
            {
                return(null);
            }

            var security = securitiesMap[secboard.security];

            return(new InstrumentParams
            {
                Instrument = instrument,
                //ExpirationDate = security.execution_day,
                PriceStep = PriceHelper.ToPrice(security.price_step),
                LotSize = security.lot_size
            });
        }