-
-
Save oecapi/e5c0f6f4bfd83f8613be to your computer and use it in GitHub Desktop.
Allocation Block Issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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