public ContractsProcessor(IGFClient client, string baseContractName) : base(client) { _baseContractName = baseContractName; Client.Contracts.Load.ContractLoadReceived += OnContractLoadReceived; Client.Contracts.Lookup.SymbolLookupReceived += OnSymbolLookupReceived; }
protected DataProcessorBase(IGFClient client) { Client = client; Client.Connection.Aggregate.Disconnected += OnDisconnected; Client.Connection.Aggregate.LoginCompleted += OnLoginComplete; _syncContext = SynchronizationContext.Current ?? new WindowsFormsSynchronizationContext(); }
private void OnPriceChanged(IGFClient client, PriceChangedEventArgs e) { if (e.Contract.ID == SubscribedContract.ID) { UpdatePrice(); } }
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; }
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; }
//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"); }
/// <summary> /// Usually called when login or password is wrong /// </summary> private void OnLoginFailed(IGFClient client, LoginFailedEventArgs e) { OnDisconnected(e.FailReason.ToString()); }
public override IClientRunner WithClient(IGFClient client) { _runner = new GFClientRunner(client); return(base.WithClient(client)); }
public virtual void Dispose() { Stop(); Client = null; }
public virtual IClientRunner WithClient(IGFClient client) { Client = client; return(this); }
private void OnContractLoadReceived(IGFClient client, Api.Contracts.Load.ContractLoadResponseEventArgs e) { Cache <ContractLoadRequestID> .Remove(e.RequestID); UpdateContracts(e.Contracts); }
public PriceProcessor(IGFClient client) : base(client) { LoadItems(new [] { _priceInfo }); }
private void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e) { UpdateStatus("Logged in"); }
private void OnSymbolLookupReceived(IGFClient client, Api.Contracts.Lookup.SymbolLookupEventArgs e) { Cache <SymbolLookupRequestID> .Remove(e.RequestID); UpdateContracts(e.Contracts); }
public PositionsProcessor(IGFClient client) : base(client) { }
protected override void OnDisconnected(IGFClient client, DisconnectedEventArgs e) { SubscribedContract = null; base.OnDisconnected(client, e); }
protected override void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e) { base.OnLoginComplete(client, e); Client.Subscriptions.Price.PriceChanged += OnPriceChanged; }
private void OnError(IGFClient client, ErrorEventArgs e) { UpdateStatus(null); MessageBox.Show(e.Exception?.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void OnDisconnected(IGFClient client, DisconnectedEventArgs e) { OnDisconnected(e.Message ?? e.Exception?.ToString()); }
protected virtual void OnLoginComplete(IGFClient client, Api.Connection.LoginCompleteEventArgs e) { }
protected override void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e) { ClearDataSource(); LoadContracts(); base.OnLoginComplete(client, e); }
private void RefreshOrders(IGFClient client, EventArgs e) { RefreshOrders(); }
protected virtual void OnDisconnected(IGFClient client, Api.Connection.DisconnectedEventArgs e) { ClearDataSource(); }
public OrdersProcessor(IGFClient client) : base(client) { }