Ejemplo n.º 1
0
 public static Trade CreateTrade(Security security, System.DateTime datetime, double price, double volume, string tradeno, SmartCOM3Lib.StOrder_Action action)
 {
     return new Trade()
     {
         ID = tradeno,
         Time = datetime,
         Price = (decimal)price,
         Volume = (decimal)volume,
         Direction = SmartToSide(action).Value,
         Security = security
     };
 }
Ejemplo n.º 2
0
 public void CancelOrders(Security security = null, eSide? direction = null)
 {
     //TODO
 }
Ejemplo n.º 3
0
        private void _smartServer_UpdateBidAsk(string symbol, int row, int nrows, double bid, double bidsize, double ask, double asksize)
        {
            if (row == 0)
            {
                updateSecurity = this.Lookup(symbol, "symbol");
                updateSecurity.Depth.Update(row, nrows, bid, bidsize, ask, asksize);
            }
            else if (updateSecurity != null)
            {
                if (row < updateSecurity.Depth.Depth)
                {
                    updateSecurity.Depth.Update(row, nrows, bid, bidsize, ask, asksize);
                }

                if (updateSecurity.Depth.IsUpdate)
                {
                    updateSecurity.Depth.IsUpdate = false;
                    OnMarketDepthChanged(updateSecurity.Depth);
                    updateSecurity = null;
                }
            }

        }
Ejemplo n.º 4
0
        public Order CreateBuyLimit(Portfolio portfolio, Security security, decimal price, decimal volume)
        {
            ++_lastUserId;

            return new Order()
            {
                UserID = _lastUserId,
                Portfolio = portfolio,
                Security = security,
                Direction = eSide.Buy,
                Type = eOrderType.Limit,
                Price = price,
                Volume = volume
            };
        }
Ejemplo n.º 5
0
        public Order CreateBuyStopLimit(Portfolio portfolio, Security security, decimal volume)
        {
            ++_lastUserId;

            return new Order()
            {
                UserID = _lastUserId,
                Portfolio = portfolio,
                Security = security,
                Direction = eSide.Sell,
                Type = eOrderType.Market,
                Price = 1,
                Volume = volume
            };
        }
Ejemplo n.º 6
0
 public void RegisterMarketDepths(Security security)
 {
     if (!RegisteredMarketDepths.Contains(security))
     {
         _smartServer.ListenBidAsks(security.Symbol);
         RegisteredMarketDepths.Add(security);
     }
 }
Ejemplo n.º 7
0
 public void UnRegisterMarketDepths(Security security)
 {
     if (RegisteredMarketDepths.Contains(security))
     {
         _smartServer.CancelBidAsks(security.Symbol);
         RegisteredMarketDepths.Remove(security);
     }
 }
Ejemplo n.º 8
0
 public void UnRegisterSecurity(Security security)
 {
     if (RegisteredSecurities.Contains(security))
     {
         _smartServer.CancelQuotes(security.Symbol);
         RegisteredSecurities.Remove(security);
     }
 }
Ejemplo n.º 9
0
 public void RegisterSecurity(Security security)
 {
     if (!RegisteredSecurities.Contains(security))
     {
         _smartServer.ListenQuotes(security.Symbol);
         RegisteredSecurities.Add(security);
     }
 }
Ejemplo n.º 10
0
 public void UnRegisterTrades(Security security)
 {
     if (RegisteredTrades.Contains(security))
     {
         _smartServer.CancelTicks(security.Symbol);
         RegisteredTrades.Remove(security);
     }
 }
Ejemplo n.º 11
0
 public void RegisterTrades(Security security)
 {
     if (!RegisteredTrades.Contains(security))
     {
         _smartServer.ListenTicks(security.Symbol);
         RegisteredTrades.Add(security);
     }
 }
Ejemplo n.º 12
0
 private void OnNewSecurities(Security security, bool lastEvent)
 {
     if (NewSecurities != null) NewSecurities(security, lastEvent);
 }