GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Implements IQFeedDataQueueHandler. · nuswgg/Lean@2d96c92

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Algorithm.CSharp
    • BasicTemplateForexAlgorithm.cs
    • QuantConnect.Algorithm.CSharp.csproj
  • Launcher
    • QuantConnect.Lean.Launcher.csproj
    • config.json
  • ToolBox
    • IQFeed
      • IQFeedDataQueueHandler.cs
      • IQ
        • DataStructures.cs
        • IQAdminSocketClient.cs
        • IQConnect.cs
        • IQCredentials.cs
        • IQLevel1Client.cs
        • IQLookupHistorySymbolClient.cs
        • IQLookupTableClient.cs
        • IQSocket.cs
        • SocketClient.cs
    • QuantConnect.ToolBox.csproj
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Algorithm.CSharp/BasicTemplateForexAlgorithm.cs‎

Copy file name to clipboard
+67Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3+
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
using QuantConnect.Data;
17+
using System.Linq;
18+
19+
namespace QuantConnect.Algorithm.CSharp
20+
{
21+
/// <summary>
22+
/// Basic template algorithm simply initializes the date range and cash
23+
/// </summary>
24+
public class BasicTemplateForexAlgorithm : QCAlgorithm
25+
{
26+
/// <summary>
27+
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
28+
/// </summary>
29+
public override void Initialize()
30+
{
31+
SetStartDate(2013, 10, 07); //Set Start Date
32+
SetEndDate(2013, 10, 11); //Set End Date
33+
SetCash(100000); //Set Strategy Cash
34+
// Find more symbols here: http://quantconnect.com/data
35+
AddForex("EURUSD", Resolution.Minute);
36+
AddForex("GBPUSD", Resolution.Minute);
37+
AddForex("EURGBP", Resolution.Minute);
38+
39+
History(5, Resolution.Daily);
40+
History(5, Resolution.Hour);
41+
History(5, Resolution.Minute);
42+
43+
var history = History(System.TimeSpan.FromSeconds(5), Resolution.Second);
44+
45+
foreach (var data in history.OrderBy(x => x.Time))
46+
{
47+
foreach (var key in data.Keys)
48+
{
49+
Log(key.Value + ": " + data.Time + " > " + data[key].Value);
50+
}
51+
}
52+
}
53+
54+
/// <summary>
55+
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
56+
/// </summary>
57+
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
58+
public override void OnData(Slice data)
59+
{
60+
// Print to console to verify that data is coming in
61+
foreach (var key in data.Keys)
62+
{
63+
Log(key.Value + ": " + data[key].Time + " > " + data[key].Value);
64+
}
65+
}
66+
}
67+
}
Collapse file

‎Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
</ItemGroup>
5151
<ItemGroup>
5252
<Compile Include="AddRemoveSecurityRegressionAlgorithm.cs" />
53+
<Compile Include="BasicTemplateForexAlgorithm.cs" />
5354
<Compile Include="BasicTemplateAlgorithm.cs" />
5455
<Compile Include="Benchmarks\EmptyMinute400EquityAlgorithm.cs" />
5556
<Compile Include="Benchmarks\Symbols.cs" />
Collapse file

‎Launcher/QuantConnect.Lean.Launcher.csproj‎

Copy file name to clipboardExpand all lines: Launcher/QuantConnect.Lean.Launcher.csproj
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@
143143
<Project>{d6633172-1368-4df6-9444-825c3e00c819}</Project>
144144
<Name>QuantConnect.Queues</Name>
145145
</ProjectReference>
146+
<ProjectReference Include="..\ToolBox\QuantConnect.ToolBox.csproj">
147+
<Project>{ac9a142c-b485-44d7-91ff-015c22c43d05}</Project>
148+
<Name>QuantConnect.ToolBox</Name>
149+
</ProjectReference>
146150
<ProjectReference Include="..\UserInterface\QuantConnect.Views.csproj">
147151
<Project>{c68beeed-b0c0-4002-94d4-1e871133d02a}</Project>
148152
<Name>QuantConnect.Views</Name>
Collapse file

‎Launcher/config.json‎

Copy file name to clipboardExpand all lines: Launcher/config.json
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@
7777
"fxcm-password": "",
7878
"fxcm-account-id": "",
7979

80+
// iqfeed configuration
81+
"iqfeed-username": "",
82+
"iqfeed-password": "",
83+
"iqfeed-productName": "",
84+
"iqfeed-version": "1.0",
85+
8086
// parameters to set in the algorithm (the below are just samples)
8187
"parameters": {
8288
"ema-fast": 10,
Collapse file

‎ToolBox/IQFeed/IQ/DataStructures.cs‎

Copy file name to clipboard
+84Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3+
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*
15+
*/
16+
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Linq;
20+
using System.Text;
21+
22+
namespace QuantConnect.ToolBox.IQFeed
23+
{
24+
public class Time
25+
{
26+
public Time(int hour = 0, int minute = 0, int second = 0)
27+
{
28+
_hour = hour;
29+
_minute = minute;
30+
_second = second;
31+
}
32+
public Time(string textTime)
33+
{
34+
if (textTime.Length < 8) { _hour = 0; _minute = 0; _second = 0; return; }
35+
if (!int.TryParse(textTime.Substring(0, 2), out _hour)) _hour = 0;
36+
if (!int.TryParse(textTime.Substring(3, 2), out _minute)) _minute = 0;
37+
if (!int.TryParse(textTime.Substring(6, 2), out _second)) _second = 0;
38+
}
39+
public int Hour { get { return _hour; } set { _hour = value; } }
40+
public int Minute { get { return _minute; } set { _minute = value; } }
41+
public int Second { get { return _second; } set { _second = value; } }
42+
public string IQFeedFormat
43+
{
44+
get
45+
{
46+
return string.Format("{0}{1}{2}", _hour.ToString("00"), _minute.ToString("00"), _second.ToString("00"));
47+
}
48+
}
49+
#region private
50+
private int _hour;
51+
private int _minute;
52+
private int _second;
53+
#endregion
54+
}
55+
56+
public enum PeriodType { Second, Minute, Hour }
57+
public class Interval
58+
{
59+
public Interval(PeriodType periodType, int periods)
60+
{
61+
_periodType = periodType;
62+
_periods = periods;
63+
}
64+
public PeriodType PeriodType { get { return _periodType; } }
65+
public int Periods { get { return _periods; } }
66+
public int Seconds
67+
{
68+
get
69+
{
70+
switch (_periodType)
71+
{
72+
case PeriodType.Second: return _periods;
73+
case PeriodType.Minute: return _periods * 60;
74+
case PeriodType.Hour: return _periods * 3600;
75+
}
76+
throw new Exception("May not get seconds for " + _periodType.ToString());
77+
}
78+
}
79+
#region private
80+
private PeriodType _periodType;
81+
private int _periods;
82+
#endregion
83+
}
84+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.