コード例 #1
0
ファイル: Form1.cs プロジェクト: alunfes/FlyerTrading
 private void buttonMarketData_Click(object sender, EventArgs e)
 {
     SystemFlg.setMasterFlg(true);
     MarketData.startMarketData();
     FlyerAPI2.startFlyerAPIMonitoring();
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: alunfes/FlyerTrading
        private async void buttonSendOrder_Click(object sender, EventArgs e)
        {
            if (SystemFlg.getMarketDataFlg() == false)
            {
                MarketData.startMarketData();
                await Task.Delay(3000);
            }


            var board = await FlyerAPI2.getBoardAsync("FX_BTC_JPY");

            double price = board.Asks.Select(x => x.Price).ToList().Min() - 1;

            var res = await FlyerAPI2.sendChiledOrderAsync("SELL", price, 0.01, 1);

            if (res.order_id != "")
            {
                addListBox2("completed send order:" + res.order_id);
            }

            if (id == "")
            {
                id = res.order_id;
            }


            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            bool   flg   = true;
            string dotti = "";

            while (flg)
            {
                var exe = await FlyerAPI2.getExecutionsAcceptanceIDAsync(res.order_id);

                System.Diagnostics.Debug.WriteLine(exe);
                if (exe.Count > 0)
                {
                    if (exe[0].child_order_accesptance_id == res.order_id)
                    {
                        flg   = false;
                        dotti = "getExecutionsAcceptanceIDAsync";
                    }
                }
                if (MarketDataLog.getExecutionStatus(res.order_id))
                {
                    flg   = false;
                    dotti = "getExecutionStatus";
                }
            }

            sw.Stop();
            id = res.order_id;
            Form1Instance.addListBox2(res.order_id + ":time=" + sw.ElapsedMilliseconds + ", dotti=" + dotti);

            SystemFlg.setMarketDataFlg(false);
            SystemFlg.setDBWriterFlg(false);

            /*
             * var board2 = await FlyerAPI2.getBoardAsync("FX_BTC_JPY");
             * var res2 = await FlyerAPI2.sendChiledOrderAsync("SELL", board2.Asks.Select(x => x.Price).ToList().Max()-1, 0.01, 1);
             *
             * var exe2 = await FlyerAPI2.getExecutionsAcceptanceIDAsync(res2.order_id);
             *
             * var posi2 = await FlyerAPI2.getPositionsAsync();
             */
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: alunfes/FlyerTrading
 private void buttonStartMasterThread_Click(object sender, EventArgs e)
 {
     MasterThread.startMasterThread();
     MarketData.startMarketData();
 }