Beispiel #1
0
		public AlfaWrapper(AlfaDirectMessageAdapter adapter)
		{
			if (adapter == null)
				throw new ArgumentNullException(nameof(adapter));

			_adapter = adapter;

			_sysCulture = ThreadingHelper.GetSystemCulture();

			_adapter.AddInfoLog(LocalizedStrings.Str2270Params, _sysCulture);

			_ad = new AlfaDirectClass();
			_ad.OnConnectionChanged += OnConnectionChanged;
			_ad.OnTableChanged += OnTableChanged;
			_ad.OrderConfirmed += OrderConfirmed;

			_tableSecurities = new AlfaTable(_ad, _adapter, AlfaTable.TableName.papers, "paper_no, p_code, ansi_name, place_code, at_code, lot_size, i_last_update, expired, mat_date, price_step, base_paper_no, go_buy, go_sell, price_step_cost, curr_code, strike");
			_tableDepth      = new AlfaTable(_ad, _adapter, AlfaTable.TableName.queue,  "paper_no, sell_qty, price, buy_qty");
			_tableLevel1     = new AlfaTable(_ad, _adapter, AlfaTable.TableName.fin_info, "paper_no, status, go_buy, go_sell, open_pos_qty, open_price, close_price, sell, sell_qty, buy, buy_qty, min_deal, max_deal, lot_size, volatility, theor_price, last_price, last_qty, last_update_date, last_update_time, price_step, buy_sqty, sell_sqty, buy_count, sell_count", "trading_status");
			_tableTrades     = new AlfaTable(_ad, _adapter, AlfaTable.TableName.all_trades, "paper_no, trd_no, qty, price, ts_time, b_s", "b_s_num");
			_tableOrders     = new AlfaTable(_ad, _adapter, AlfaTable.TableName.orders, "ord_no, acc_code, paper_no, status, b_s, price, qty, rest, ts_time, comments, place_code, stop_price, avg_trd_price, blank, updt_grow_price, updt_down_price, updt_new_price, trailing_level, trailing_slippage", "order_status, b_s_str");
			_tablePositions  = new AlfaTable(_ad, _adapter, AlfaTable.TableName.balance, "acc_code, p_code, place_code, paper_no, income_rest, real_rest, forword_rest, pl, profit_vol, income_vol, real_vol, open_vol, var_margin, balance_price");
			_tableMyTrades   = new AlfaTable(_ad, _adapter, AlfaTable.TableName.trades, "trd_no, ord_no, treaty, paper_no, price, qty, b_s, ts_time", "b_s_str");
			_tableNews       = new AlfaTable(_ad, _adapter, AlfaTable.TableName.news, "new_no, provider, db_data, subject, body");
			_tableAccounts   = new AlfaTable(_ad, _adapter, AlfaTable.TableName.accounts, "treaty");

			_connState = IsConnected ? ConnectionStates.Connected : ConnectionStates.Disconnected;

			_adapter.AddInfoLog("AlfaDirect {0}", _ad.Version.ToString());
		}
Beispiel #2
0
        public AlfaWrapper(AlfaDirectMessageAdapter adapter)
        {
            if (adapter == null)
            {
                throw new ArgumentNullException("adapter");
            }

            _adapter = adapter;

            _sysCulture = ThreadingHelper.GetSystemCulture();

            _adapter.AddInfoLog(LocalizedStrings.Str2270Params, _sysCulture);

            _ad = new AlfaDirectClass();
            _ad.OnConnectionChanged += OnConnectionChanged;
            _ad.OnTableChanged      += OnTableChanged;
            _ad.OrderConfirmed      += OrderConfirmed;

            _tableSecurities = new AlfaTable(_ad, _adapter, AlfaTable.TableName.papers, "paper_no, p_code, ansi_name, place_code, at_code, lot_size, i_last_update, expired, mat_date, price_step, base_paper_no, go_buy, go_sell, price_step_cost, curr_code, strike");
            _tableDepth      = new AlfaTable(_ad, _adapter, AlfaTable.TableName.queue, "paper_no, sell_qty, price, buy_qty");
            _tableLevel1     = new AlfaTable(_ad, _adapter, AlfaTable.TableName.fin_info, "paper_no, status, go_buy, go_sell, open_pos_qty, open_price, close_price, sell, sell_qty, buy, buy_qty, min_deal, max_deal, lot_size, volatility, theor_price, last_price, last_qty, last_update_date, last_update_time, price_step, buy_sqty, sell_sqty, buy_count, sell_count", "trading_status");
            _tableTrades     = new AlfaTable(_ad, _adapter, AlfaTable.TableName.all_trades, "paper_no, trd_no, qty, price, ts_time, b_s", "b_s_num");
            _tableOrders     = new AlfaTable(_ad, _adapter, AlfaTable.TableName.orders, "ord_no, acc_code, paper_no, status, b_s, price, qty, rest, ts_time, comments, place_code, stop_price, avg_trd_price, blank, updt_grow_price, updt_down_price, updt_new_price, trailing_level, trailing_slippage", "order_status, b_s_str");
            _tablePositions  = new AlfaTable(_ad, _adapter, AlfaTable.TableName.balance, "acc_code, p_code, place_code, paper_no, income_rest, real_rest, forword_rest, pl, profit_vol, income_vol, real_vol, open_vol, var_margin, balance_price");
            _tableMyTrades   = new AlfaTable(_ad, _adapter, AlfaTable.TableName.trades, "trd_no, ord_no, treaty, paper_no, price, qty, b_s, ts_time", "b_s_str");
            _tableNews       = new AlfaTable(_ad, _adapter, AlfaTable.TableName.news, "new_no, provider, db_data, subject, body");
            _tableAccounts   = new AlfaTable(_ad, _adapter, AlfaTable.TableName.accounts, "treaty");

            _connState = IsConnected ? ConnectionStates.Connected : ConnectionStates.Disconnected;

            _adapter.AddInfoLog("AlfaDirect {0}", _ad.Version.ToString());
        }
 public TerminalConnector(string account, string placeCode, string pCode)
 {
     this.account = account;
     this.placeCode = placeCode;
     this.pCode = pCode;
     alfaDirect = new AlfaDirectClass();
 }
Beispiel #4
0
        public AlfaTable(AlfaDirectClass ad, ILogReceiver logReceiver, TableName name, string fields, string uniqueNames = null)
        {
            _ad          = ad;
            _logReceiver = logReceiver;
            Name         = name.ToString();
            Fields       = new FieldList(this, logReceiver, fields, uniqueNames);
            _strFields   = Fields.Names.Join(",");

            _supportInFilter = name != TableName.queue;
            _supportUpdates  = name != TableName.queue && name != TableName.balance;
            _globalFilter    =
                name == TableName.all_trades ? "AT" :
                name == TableName.fin_info ? "FI" :
                name == TableName.queue ? "Q" :
                null;

            _filtered = _globalFilter != null;

            if (_filtered)
            {
                FilterPapers = new HashSet <int>();
            }
        }