Пример #1
0
 public ContractsProcessor(IGFClient client, string baseContractName)
     : base(client)
 {
     _baseContractName = baseContractName;
     Client.Contracts.Load.ContractLoadReceived   += OnContractLoadReceived;
     Client.Contracts.Lookup.SymbolLookupReceived += OnSymbolLookupReceived;
 }
Пример #2
0
 protected DataProcessorBase(IGFClient client)
 {
     Client = client;
     Client.Connection.Aggregate.Disconnected   += OnDisconnected;
     Client.Connection.Aggregate.LoginCompleted += OnLoginComplete;
     _syncContext = SynchronizationContext.Current ?? new WindowsFormsSynchronizationContext();
 }
Пример #3
0
 private void OnPriceChanged(IGFClient client, PriceChangedEventArgs e)
 {
     if (e.Contract.ID == SubscribedContract.ID)
     {
         UpdatePrice();
     }
 }
Пример #4
0
        protected override void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e)
        {
            base.OnLoginComplete(client, e);

            RefreshPositions();
            client.Accounts.BalanceChanged        += RefreshPositions;
            client.Accounts.AvgPositionChanged    += RefreshPositions;
            client.Accounts.AccountSummaryChanged += RefreshPositions;
        }
Пример #5
0
        protected override void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e)
        {
            base.OnLoginComplete(client, e);

            RefreshOrders();
            Client.Orders.OrderFilled       += RefreshOrders;
            Client.Orders.CommandUpdated    += RefreshOrders;
            Client.Orders.OrderConfirmed    += RefreshOrders;
            Client.Orders.OrderStateChanged += RefreshOrders;
        }
Пример #6
0
        //Modified to CALL TRAILSTOP constantly upon any changes in position.
        private void RefreshPositions(IGFClient client, EventArgs e)
        {
            RefreshPositions();
            RunCatTrail(e);                 //Hoping this is the thing called ^^ via += ?  It MUST be bc this CALLS other, so this is called first.
            Debug.WriteLine("Called RunCatTrail() via RefreshPositions");


            //IF run only ONCE ...
            //Run(e);
            //Debug.WriteLine("Called Run() via RefreshPositions");
        }
Пример #7
0
 /// <summary>
 ///     Usually called when login or password is wrong
 /// </summary>
 private void OnLoginFailed(IGFClient client, LoginFailedEventArgs e)
 {
     OnDisconnected(e.FailReason.ToString());
 }
Пример #8
0
 public override IClientRunner WithClient(IGFClient client)
 {
     _runner = new GFClientRunner(client);
     return(base.WithClient(client));
 }
Пример #9
0
 public virtual void Dispose()
 {
     Stop();
     Client = null;
 }
Пример #10
0
 public virtual IClientRunner WithClient(IGFClient client)
 {
     Client = client;
     return(this);
 }
Пример #11
0
        private void OnContractLoadReceived(IGFClient client, Api.Contracts.Load.ContractLoadResponseEventArgs e)
        {
            Cache <ContractLoadRequestID> .Remove(e.RequestID);

            UpdateContracts(e.Contracts);
        }
Пример #12
0
 public PriceProcessor(IGFClient client)
     : base(client)
 {
     LoadItems(new [] { _priceInfo });
 }
Пример #13
0
 private void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e)
 {
     UpdateStatus("Logged in");
 }
Пример #14
0
        private void OnSymbolLookupReceived(IGFClient client, Api.Contracts.Lookup.SymbolLookupEventArgs e)
        {
            Cache <SymbolLookupRequestID> .Remove(e.RequestID);

            UpdateContracts(e.Contracts);
        }
Пример #15
0
 public PositionsProcessor(IGFClient client)
     : base(client)
 {
 }
Пример #16
0
 protected override void OnDisconnected(IGFClient client, DisconnectedEventArgs e)
 {
     SubscribedContract = null;
     base.OnDisconnected(client, e);
 }
Пример #17
0
 protected override void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e)
 {
     base.OnLoginComplete(client, e);
     Client.Subscriptions.Price.PriceChanged += OnPriceChanged;
 }
Пример #18
0
 private void OnError(IGFClient client, ErrorEventArgs e)
 {
     UpdateStatus(null);
     MessageBox.Show(e.Exception?.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Пример #19
0
 private void OnDisconnected(IGFClient client, DisconnectedEventArgs e)
 {
     OnDisconnected(e.Message ?? e.Exception?.ToString());
 }
Пример #20
0
 protected virtual void OnLoginComplete(IGFClient client, Api.Connection.LoginCompleteEventArgs e)
 {
 }
Пример #21
0
 protected override void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e)
 {
     ClearDataSource();
     LoadContracts();
     base.OnLoginComplete(client, e);
 }
Пример #22
0
 private void RefreshOrders(IGFClient client, EventArgs e)
 {
     RefreshOrders();
 }
Пример #23
0
 protected virtual void OnDisconnected(IGFClient client, Api.Connection.DisconnectedEventArgs e)
 {
     ClearDataSource();
 }
Пример #24
0
 public OrdersProcessor(IGFClient client)
     : base(client)
 {
 }