Skip to content

Instantly share code, notes, and snippets.

@oecapi
Created November 12, 2015 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oecapi/e5c0f6f4bfd83f8613be to your computer and use it in GitHub Desktop.
Save oecapi/e5c0f6f4bfd83f8613be to your computer and use it in GitHub Desktop.
Allocation Block Issue
using System;
using OEC.API;
using OEC.Data;
namespace AllocBlockTest_FQ_21
{
class Program
{
static void Main(string[] args)
{
new Program().MakeTest();
while (!Console.KeyAvailable)
{
System.Threading.Thread.Sleep(1);
System.Windows.Forms.Application.DoEvents();
}
}
private void MakeTest()
{
OECClient client = new OECClient();
OECClient client2 = new OECClient(); //!!!Comment this to make it work
client.OnLoginComplete += () =>
{
OEC.API.NewOrderDraft draft = client.CreateDraft();
draft.Account = null;
foreach (var ab in client.AllocationBlocks)
{
if (ab.Name == "AllocationBlock01")
{
draft.AllocationBlock = ab;
}
}
draft.Contract = client.Contracts["HK40"];
draft.Quantity = 3;
draft.Type = OrderType.Market;
OrderParts res = draft.GetInvalidParts();
if (res != OEC.API.OrderParts.None)
throw new Exception(string.Format("Invalid values in {0}", res));
};
client.Connect("host", 9200, "user", "password", true);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment