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 }; }
public static eSide? SmartToSide(SmartCOM3Lib.StOrder_Action action) { switch (action) { case SmartCOM3Lib.StOrder_Action.StOrder_Action_Buy : { return eSide.Buy; } case SmartCOM3Lib.StOrder_Action.StOrder_Action_Sell : { return eSide.Sell; } default: break; } return null; }
private void _smartServer_SetMyTrade(int row, int nrows, string portfolio, string symbol, System.DateTime datetime, double price, double volume, string tradeno, SmartCOM3Lib.StOrder_Action buysell, string orderno) { //TODO }
private void _smartServer_SetMyOrder(int row, int nrows, string portfolio, string symbol, SmartCOM3Lib.StOrder_State state, SmartCOM3Lib.StOrder_Action action, SmartCOM3Lib.StOrder_Type type, SmartCOM3Lib.StOrder_Validity validity, double price, double amount, double stop, double filled, System.DateTime datetime, string id, string no, int cookie) { //TODO }
private void _smartServer_UpdateOrder(string portfolio, string symbol, SmartCOM3Lib.StOrder_State state, SmartCOM3Lib.StOrder_Action action, SmartCOM3Lib.StOrder_Type type, SmartCOM3Lib.StOrder_Validity validity, double price, double amount, double stop, double filled, System.DateTime datetime, string orderid, string orderno, int status_mask, int cookie) { //TODO }
private void _smartServer_AddTick(string symbol, System.DateTime datetime, double price, double volume, string tradeno, SmartCOM3Lib.StOrder_Action action) { Trade trade = Helpers.CreateTrade(this.Lookup(symbol, "Symbol"), datetime, price, volume, tradeno, action); if (trade != null) { OnNewTrades(trade); } }
private void _smartServer_AddPortfolio(int row, int nrows, string portfolioName, string portfolioExch, SmartCOM3Lib.StPortfolioStatus portfolioStatus) { if (portfolioStatus == StPortfolioStatus.StPortfolioStatus_Broker) { Portfolios.Add(new Portfolio(portfolioName, portfolioExch)); _smartServer.ListenPortfolio(portfolioName); } if (row == nrows) OnNewPortfolios(Portfolios); }