Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 236
Expand file tree
/
Copy pathMainProgram.cs
More file actions
Latest commit
35 lines (35 loc) · 1.45 KB
/
Copy pathMainProgram.cs
File metadata and controls
35 lines (35 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
classMainProgram{
classMyEventHandler:ccapi.EventHandler{
publicoverridevoidProcessEvent(ccapi.Eventevent_,ccapi.Sessionsession){
System.Console.WriteLine(string.Format("Received an event:\n{0}",event_.ToStringPretty(2,2)));
}
}
staticvoidMain(string[]args){
if(System.Environment.GetEnvironmentVariable("OKX_API_KEY")isnull){
System.Console.Error.WriteLine("Please set environment variable OKX_API_KEY");
return;
}
if(System.Environment.GetEnvironmentVariable("OKX_API_SECRET")isnull){
System.Console.Error.WriteLine("Please set environment variable OKX_API_SECRET");
return;
}
if(System.Environment.GetEnvironmentVariable("OKX_API_PASSPHRASE")isnull){
System.Console.Error.WriteLine("Please set environment variable OKX_API_PASSPHRASE");
return;
}
vareventHandler=newMyEventHandler();
varoption=newccapi.SessionOptions();
varconfig=newccapi.SessionConfigs();
varsession=newccapi.Session(option,config,eventHandler);
varrequest=newccapi.Request(ccapi.Request.Operation.CREATE_ORDER,"okx","BTC-USDT");
varparam=newccapi.MapStringString();
param.Add("SIDE","BUY");
param.Add("QUANTITY","0.0005");
param.Add("LIMIT_PRICE","20000");
request.AppendParam(param);
session.SendRequest(request);
System.Threading.Thread.Sleep(10000);
session.Stop();
System.Console.WriteLine("Bye");
}
}