I'm trying to refactor the Tradelink code to add a new Broker. I just want to implement a price server for the moment. I don't want position management or accounts or anything: I just want Quotopia to display whatever ticks I send to it from the new server.
I can get Quotopia to recognize that the server is running, but can't fire the _bf.gotTick() method in Quotopia. What am I doing wrong?
using System;
using System.Collections.Generic;
using System.Threading;
using System.Windows.Forms;
using TradeLink.API;
using TradeLink.AppKit;
using TradeLink.Common;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
TestServer server = new TestServer();
}
}
class TestServer
{
public const string PROGRAM = "TestServer";
Log _log = new Log(PROGRAM);
TradeLink.API.TLServer tls;
public TestServer()
{
tls = new TradeLink.Common.TLServer_WM();
tls.newProviderName = Providers.Unknown;
tls.newRegisterSymbols += new SymbolRegisterDel(tl_newRegisterSymbols);
tls.VerboseDebugging = true;
}
public void Start()
{
while (true)
{
System.Diagnostics.Debug.WriteLine("Sending tick!");
Tick t = new TickImpl();
t.date = Util.ToTLDate(DateTime.Now);
t.time = Util.DT2FT(DateTime.Now);
t.symbol = "GOOG";
t.bid = Convert.ToDecimal(101.00);
t.ask = Convert.ToDecimal(102.00);
t.ex = "none";
tls.newTick(t);
System.Threading.Thread.Sleep(2000);
}
}
private void tl_newRegisterSymbols(string client, string symbols)
{
System.Diagnostics.Debug.WriteLine("tl_newRegisterSymbols");
var t = new Thread(() => Start());
}
}
}
I can get Quotopia to recognize that the server is running, but can't fire the _bf.gotTick() method in Quotopia. What am I doing wrong?
using System;
using System.Collections.Generic;
using System.Threading;
using System.Windows.Forms;
using TradeLink.API;
using TradeLink.AppKit;
using TradeLink.Common;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
TestServer server = new TestServer();
}
}
class TestServer
{
public const string PROGRAM = "TestServer";
Log _log = new Log(PROGRAM);
TradeLink.API.TLServer tls;
public TestServer()
{
tls = new TradeLink.Common.TLServer_WM();
tls.newProviderName = Providers.Unknown;
tls.newRegisterSymbols += new SymbolRegisterDel(tl_newRegisterSymbols);
tls.VerboseDebugging = true;
}
public void Start()
{
while (true)
{
System.Diagnostics.Debug.WriteLine("Sending tick!");
Tick t = new TickImpl();
t.date = Util.ToTLDate(DateTime.Now);
t.time = Util.DT2FT(DateTime.Now);
t.symbol = "GOOG";
t.bid = Convert.ToDecimal(101.00);
t.ask = Convert.ToDecimal(102.00);
t.ex = "none";
tls.newTick(t);
System.Threading.Thread.Sleep(2000);
}
}
private void tl_newRegisterSymbols(string client, string symbols)
{
System.Diagnostics.Debug.WriteLine("tl_newRegisterSymbols");
var t = new Thread(() => Start());
}
}
}