Interactive Brokers TWS connection not working


Interactive Brokers TWS connection not working
Atom Reply
1/13/2020


Hello, I tried to follow this video (https://stocksharp.com/forum/10058/Lesson-1-The-first-connection-creating/), I did exactly every step like the video but the securities never showed up, I'm uploading a video for you to see.

Thanks



Thanks:




8 Answers
Support

Avatar
Date: 1/16/2020
Reply


Thank you for your question.

IB connection does not provide automatic instruments downloading. In that case, from the app, you need to send searching requests via Connector.LookupSecurities. All found instruments will be provided via Connector.NewSecurity or Connector.LookupSecuritiyFinished events.

On our environment, the lesson shows AAPL instruments

4cc0d011bfcfb4f5e6a05fa279f3ba8d.png

Can you provide the link from where you have downloaded the materials?

PS We updated your support plus 1 week for the answer days reason.
Thanks:

isaacapuano

Avatar
Training
Date: 1/17/2020
Reply


I downloaded the materials from here, https://github.com/StockSharp/StockSharp/releases.

I'm not sure how to do the search request, in the video on minute 14 Yury clicks on the securities and starts to recieve information. I tried once more but got the same result, im just writing the code I see in the video.

here is my code
Код

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StockSharp"
xmlns:Custom="http://schemas.stocksharp.com/xaml" x:Class="StockSharp.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="660" Width="900" Left="50" Top="50">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130*"/>
<ColumnDefinition Width="130*"/>
<ColumnDefinition Width="504*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="35*"/>
<RowDefinition Height="594*"/>
</Grid.RowDefinitions>
<Button Content="Setting" Name="Setting" Click="Setting_Click" HorizontalAlignment="Left" VerticalAlignment="Top" Width="152" Height="35"/>
<Button Content="Connect" Name="Connect" Click="Connect_Click" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="152" Height="35"/>

<Custom:SecurityPicker Name="SecurityPicker" ShowCommonStatColumns="True" Grid.ColumnSpan="3" HorizontalAlignment="Left" Height="594" Grid.Row="1" VerticalAlignment="Top" Width="892"/>

</Grid>
</Window>


Код

using Ecng.Serialization;
using StockSharp.Algo;
using StockSharp.BusinessEntities;
using StockSharp.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace StockSharp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
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.Connect();
}
private void SecurityPicker_SecuritySelected(Security security)
{
if (security == null) return;
_connector.RegisterSecurity(security);
}
}
}


Topic starter
Thanks:

Support

Avatar
Date: 1/17/2020
Reply


isaacapuano Go to
I downloaded the materials from here, https://github.com/StockSharp/StockSharp/releases.


Please the following links (any, not all)

1) https://stocksharp.com/f...ckSharp-training-course/ (edu materials)
2) https://stocksharp.com/products/download/ (Night build link) (public samples only)

Currently, the official release contains 4.4.16 version. This version is out of date and we recommend use 4.4.17 (many fixes and improvements).
Thanks:

isaacapuano

Avatar
Training
Date: 1/18/2020
Reply


Support Go to
isaacapuano Go to
I downloaded the materials from here, https://github.com/StockSharp/StockSharp/releases.


Please the following links (any, not all)

1) https://stocksharp.com/f...ckSharp-training-course/ (edu materials)
2) https://stocksharp.com/products/download/ (Night build link) (public samples only)

Currently, the official release contains 4.4.16 version. This version is out of date and we recommend use 4.4.17 (many fixes and improvements).


I downloaded the version 4.4.17, and now when I click stettings there is no list of connectors anymore, it appears all white

Topic starter
Thanks:

Support

Avatar
Date: 1/18/2020
Reply


isaacapuano Go to


I downloaded the version 4.4.17, and now when I click stettings there is no list of connectors anymore, it appears all white



1) Did you unblock the archive before unzip?
2) Please try to add as reference to the project StockSharp.InteractiveBrokers.dll.
Thanks:

isaacapuano

Avatar
Training
Date: 1/19/2020
Reply


Support Go to
isaacapuano Go to


I downloaded the version 4.4.17, and now when I click stettings there is no list of connectors anymore, it appears all white



1) Did you unblock the archive before unzip?
2) Please try to add as reference to the project StockSharp.InteractiveBrokers.dll.


Yes I unblocked the zip.
I added the reference and now it shows up but i still cant see anything not even if I search for securitys, I even started all over again and same result, i got an error when adding the toolbox im uploading a screenshot of the error and a video of the app
2.PNG 34.9KB (6) 2020-01-18 16-10-53.mp4 5.5MB (6)
Topic starter
Thanks:

Support

Avatar
Date: 1/19/2020
Reply


I am sorry but I cannot understand from where you downloaded the code on your video. Please use this direct link https://stocksharp.com/f...109596/Lesson_4_4_17_7z/ There code missed 2 points:

1) It does not have a reference on StockSharp.Configuration.Adapters - the reason why you do not any connectors on Settings window.
2) It does not have a lookup securities code on a connected event as I mentioned above: _connector.LookupSecurities(new Security() { Code = "AAPL" });

Please download materials from the link I've provided and try to run Lessons\lesson_01(simple_terminal)\01_Connect_and_get_security project.

Thanks:

isaacapuano

Avatar
Training
Date: 1/29/2020
Reply


Support Go to
I am sorry but I cannot understand from where you downloaded the code on your video. Please use this direct link https://stocksharp.com/f...109596/Lesson_4_4_17_7z/ There code missed 2 points:

1) It does not have a reference on StockSharp.Configuration.Adapters - the reason why you do not any connectors on Settings window.
2) It does not have a lookup securities code on a connected event as I mentioned above: _connector.LookupSecurities(new Security() { Code = "AAPL" });

Please download materials from the link I've provided and try to run Lessons\lesson_01(simple_terminal)\01_Connect_and_get_security project.



Hello and sorry for the delay, I downloaded and ran the program and everything works well, I see where I went wrong now.
Thanks
Topic starter
Thanks:


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

loading
clippy