Esempio n. 1
0
        private static void accountOperations(EClientSocket client)
        {
            /*** Requesting managed accounts***/
            //! [reqmanagedaccts]
            client.reqManagedAccts();
            //! [reqmanagedaccts]
            /*** Requesting accounts' summary ***/
            Thread.Sleep(2000);
            //! [reqaaccountsummary]
            client.reqAccountSummary(9001, "All", AccountSummaryTags.GetAllTags());
            //! [reqaaccountsummary]

            //! [reqaaccountsummaryledger]
            client.reqAccountSummary(9002, "All", "$LEDGER");
            //! [reqaaccountsummaryledger]
            Thread.Sleep(2000);
            //! [reqaaccountsummaryledgercurrency]
            client.reqAccountSummary(9003, "All", "$LEDGER:EUR");
            //! [reqaaccountsummaryledgercurrency]
            Thread.Sleep(2000);
            //! [reqaaccountsummaryledgerall]
            client.reqAccountSummary(9004, "All", "$LEDGER:ALL");
            //! [reqaaccountsummaryledgerall]

            //! [cancelaaccountsummary]
            client.cancelAccountSummary(9001);
            client.cancelAccountSummary(9002);
            client.cancelAccountSummary(9003);
            client.cancelAccountSummary(9004);
            //! [cancelaaccountsummary]

            /*** Subscribing to an account's information. Only one at a time! ***/
            Thread.Sleep(2000);
            //! [reqaaccountupdates]
            client.reqAccountUpdates(true, "U150462");
            //! [reqaaccountupdates]
            Thread.Sleep(2000);
            //! [cancelaaccountupdates]
            client.reqAccountUpdates(false, "U150462");
            //! [cancelaaccountupdates]

            //! [reqaaccountupdatesmulti]
            client.reqAccountUpdatesMulti(9002, "U150462", "EUstocks", true);
            //! [reqaaccountupdatesmulti]

            Thread.Sleep(2000);
            /*** Requesting all accounts' positions. ***/
            //! [reqpositions]
            client.reqPositions();
            //! [reqpositions]
            Thread.Sleep(2000);
            //! [cancelpositions]
            client.cancelPositions();
            //! [cancelpositions]

            //! [reqpositionsmulti]
            client.reqPositionsMulti(9003, "DU74649", "EUstocks");
            //! [reqpositionsmulti]
        }
Esempio n. 2
0
 /// <summary>
 /// Called when Connectivity between IB and TWS has been restored(Code 1102),
 /// <para> Or when A market data farm is connected(Code 2104).Usually occurred after disconnection.</para>
 ///  </summary>
 public void ResetAccountSummaryRequest()
 {
     _clientSocket.cancelAccountSummary(0);
     RequestAccountData();
 }