Esempio n. 1
0
        public FutureEnterResult EnterFutureOrder(OrderEnterDirection direction, string futureCode, decimal price, int qty, FutureEnterPriceType priceType, FutureEnterTradeType tradeType, FutureEnterPositionType positionType)
        {
            string            record = OrderApi.future_order("", "", "", "", "", "", "", "", "");
            FutureEnterResult result = new FutureEnterResult();

            return(result.ParseRecord(record));
        }
Esempio n. 2
0
        public StockEnterResult EnterStockOrder(OrderEnterDirection direction, string stockCode, decimal price, int qty, StockEnterPriceType priceType)
        {
            string record
                = OrderApi.stock_order("B", "", "", "", "", "", "", "");
            StockEnterResult result = new StockEnterResult();

            return(result.ParseRecord(record));
        }
Esempio n. 3
0
        private SinopacOrderAgent()
        {
            //可以利用讀取設定檔的方式來初始化這個library
            string apiInitializeResult = OrderApi.init_t4("", "", "");

            if (apiInitializeResult.StartsWith("Error"))
            {
                throw new Exception("下單元件初始化失敗");
            }

            string loadCaResult = OrderApi.add_acc_ca("", "", "", "", "");

            if (loadCaResult.StartsWith("Error"))
            {
                throw new Exception("讀取憑證錯誤");
            }

            string testCaResult = OrderApi.verify_ca_pass("", "");

            if (testCaResult.StartsWith("Error"))
            {
                throw new Exception("測試憑證錯誤");
            }

            _apiVersion = OrderApi.show_version();
            Console.WriteLine("Api Version: {0}", _apiVersion);

            _serverIp = OrderApi.show_ip(); // ip should be sinotrade.com.tw
            Console.WriteLine("Server IP: {0}", _serverIp);

            _accountsOfThisId = OrderApi.show_list();
            Console.WriteLine("Accounts Of This Id: {0}", _accountsOfThisId);

            _echoSetting = OrderApi.change_echo();//default is [ ON ], Now I call the function, it should be [ Off ]
            Console.WriteLine("Echo setting: {0}", _echoSetting);
        }
Esempio n. 4
0
        public void DestroyInstance()
        {
            int ret = OrderApi.log_out();

            _instance = null;
        }
Esempio n. 5
0
 public void QueryResponseRecord()
 {
     string record = OrderApi.get_response_log();
 }
Esempio n. 6
0
 public void EnterOptionOrder()
 {
     string            record = OrderApi.option_order("", "", "", "", "", "", "", "", "", "", "", "");
     OptionEnterResult result = new OptionEnterResult();
 }