I got the currency list to show by adding the Oanda nuget pkg, but I am not seeing the price of the security when i click on a currency.


I got the currency list to show by adding the Oanda nuget pkg, but I am not seeing the price of the security when i click on a currency.
Atom Reply
9/2/2020


I got the currency list to show by adding the Oanda nuget pkg, but I am not seeing the price of the security when i click on a currency.

public partial class MainWindow : Window
{
private Connector _connector = new Connector();
private string _connectFile = "ConnectFile";

public MainWindow()
{
InitializeComponent();
if (File.Exists(_connectFile))
{
_connector.Load(new XmlSerializer<SettingsStorage>().Deserialize(_connectFile));
}
}

private void Setting_Click(object sender, RoutedEventArgs e)
{
if (_connector.Configure(this))
{
new XmlSerializer<SettingsStorage>().Serialize(_connector.Save(), _connectFile);
}
}

private void Connect_Click(object sender, RoutedEventArgs e)
{
SecurityPicker.SecurityProvider = _connector;
SecurityPicker.MarketDataProvider = _connector;
_connector.Connected += this.Connector_Connected;

_connector.Connect();
}

private void Connector_Connected()
{
_connector.LookupSecurities(new Security() { Code = "USD/JPY" });
}

private void SecurityPicker_SecuritySelected(Security security)
{
if (security == null) return;
_connector.SubscribeFilteredMarketDepth(security);
//_connector.RegisterSecurity(security);
}
}



Thanks:




12 Answers
Support

Avatar
Date: 9/2/2020
Reply


Hello

Please use this method https://stocksharp.com/posts/m/51282/
Thanks:

Vladimir Vincent

Avatar
Date: 9/2/2020
Reply


Ref: Oanda.
I have used the function _connector.SubscribeMarketDepth(security); and its still does not work. It does not show the price of the currency see code below.
I have clicked on the currency, and the price do not show.
This is really frustrating, both the lesson video and documentation is lacking.
Please send a working code for the first lesson video.

public partial class MainWindow : Window
{
private Connector _connector = new Connector();
private string _connectFile = "ConnectFile";

public MainWindow()
{
InitializeComponent();
if (File.Exists(_connectFile))
{
_connector.Load(new XmlSerializer<SettingsStorage>().Deserialize(_connectFile));
}
}

private void Setting_Click(object sender, RoutedEventArgs e)
{
if (_connector.Configure(this))
{
new XmlSerializer<SettingsStorage>().Serialize(_connector.Save(), _connectFile);
}
}

private void Connect_Click(object sender, RoutedEventArgs e)
{
SecurityPicker.SecurityProvider = _connector;
SecurityPicker.MarketDataProvider = _connector;
_connector.Connected += this.Connector_Connected;

_connector.Connect();
}

private void Connector_Connected()
{
_connector.LookupSecurities(new Security() { Code = "USD/JPY" });
}

private void SecurityPicker_SecuritySelected(Security security)
{
if (security == null) return;
_connector.SubscribeMarketDepth(security);
}
}
image5905.png 71 KB (0)
Topic starter
Thanks:

Support

Avatar
Date: 9/2/2020
Reply


In attach the whole project. Video - https://i.gyazo.com/60cb...eaad928b43dda5dfbe57.mp4

Please try again the project.
Thanks:

Support

Avatar
Date: 9/3/2020
Reply


Hello

Your codes works well https://i.gyazo.com/f27e...e3911047fb5d9e76454e.mp4

1) Do you use demo account?
2) Do you use some VPN or firewalls?
Thanks:

Vladimir Vincent

Avatar
Date: 9/3/2020
Reply



Yes, I am using a demo account on Oanda.
No, I do not use VPN or firewalls
Topic starter
Thanks:

Support

Avatar
Date: 9/3/2020
Reply


Vladimir Vincent Go to

Yes, I am using a demo account on Oanda.
No, I do not use VPN or firewalls


Send us to support@stocksharp.com your token, please. We will try it with your codes.
Thanks:

Vladimir Vincent

Avatar
Date: 9/3/2020
Reply



Ok, I have sent the Oanda token via email.
Topic starter
Thanks:

Support

Avatar
Date: 9/3/2020
Reply


Vladimir Vincent Go to

Ok, I have sent the Oanda token via email.


Your account do not work as well. How long you use your demo account? It is newly created or your created many months ago?
Thanks:

Vladimir Vincent

Avatar
Date: 9/3/2020
Reply


The Oanda account is newly created last week.
Topic starter
Thanks:

Support

Avatar
Date: 9/3/2020
Reply


Vladimir Vincent Go to
The Oanda account is newly created last week.


You can try this one deleted - it is create today. Do you have prices?
Thanks:

Vladimir Vincent

Avatar
Date: 9/3/2020
Reply


Yes, the price are showing for the key you provided. I am not sure why my key is not working.
Topic starter
Thanks:

Vladimir Vincent

Avatar
Date: 9/3/2020
Reply


I have contacted Oanda, They told me my account was on an old server, I had to re-recreate the account again. So, my new API key is working properly.
I am seeing price for all currency pair. Now, I can continue with the lessons.

Thank you for your patient and help.
Topic starter
Thanks:


Attach files by dragging & dropping, , or pasting from the clipboard.

loading
clippy