API Support Forum
User Profile

Viewing User Profile for: AWhite1863TM


About

Feb 25, 2021 11:53 AM

May 01, 2021 11:33 AM

Jun 21, 2021 10:30 AM



Post Statistics
AWhite1863TM has contributed to 1 posts out of 5677 total posts (0.02%) in 1366 days (0.00 posts per day).

20 most recent posts:

API Support » Not able to Pull Latest Contracts for some Symbols May 01, 2021 @ 11:33 AM (Total replies: 1)

I am unable to pull the latest contracts for symbols (see pic). The nearest contract the API is returning is Feb 2022, not Jun 21 as shown in the Gain Developer Trader app.
Please advise Thanks.



Please See Pics
https://www.dropbox.com/sh/2iliq7emxj91twz/AACMH-C0fkEvsW8OVXP4kcq3a?dl=0

The code i am using


var objSymbolLookup = new SymbolLookupByCriteriaResponseHandler(this.Mn.GFClient1);

Action> addExpMonthAction = (contracts) =>
{
var lstGetContracts = this.Mn.GFClient1.Contracts.Get();

if (contracts != null)
{
var selectedValue = "";

foreach (var contract in contracts)
{
if (contract.BaseContract.Symbol == symbol && !contract.IsContinuous)
{
var expMonth = this.ConvertConMonStr(contract.ExpirationMonth);
var monthYear = contract.ElectronicContract.MonthYear;

var finalValue = $"{expMonth} ({monthYear})";

lstMonths.Add(new Code.ComboBoxItem() { DisplayMember = finalValue, ValueMember = expMonth });

}
}

this.CBMonth.DisplayMemberPath = "DisplayMember";
this.CBMonth.SelectedValuePath = "ValueMember";

if (this.CBMonth.ItemsSource == null)
this.CBMonth.ItemsSource = lstMonths;

}
else
{
Console.WriteLine("Contract is not found");
}
};

Action> action = (contracts) =>
{
if (this.InvokeRequired())
{
this.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => addExpMonthAction.Invoke(contracts)));
}
else
{
addExpMonthAction.Invoke(contracts);
}
};

objSymbolLookup.ResolveSymbol(objContractGroup, symbol, action);


Edited by AWhite1863TM on May 01, 2021 11:35 AM