API Support Forum
OEC API > API Support > Not able to Pull Latest Contracts for some Symbols
Author Topic: Not able to Pull Latest Contracts for some Symbols
(2 messages, Page 1 of 1)
Moderators: VPfau
AWhite1863TM
Posts: 1
Joined: Feb 25, 2021


Posted: May 01, 2021 @ 11:33 AM             Msg. 1 of 2
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
JSmith5611
Posts: 187
Joined:


Posted: May 06, 2021 @ 11:55 AM             Msg. 2 of 2
I don't see your lookup request in that code block.
Which address are you logging into, and what is your username so i can check through logs? (and when you were trying this)
Jason Smith