public Icbit(uint userid, string authToken) { orders = new ConcurrentDictionary<long, Order>[2]; orders[0] = new ConcurrentDictionary<long, Order>(); orders[1] = new ConcurrentDictionary<long, Order>(); balance = new ConcurrentDictionary<string, Position>(); instruments = new ConcurrentDictionary<string, Instrument>[2]; instruments[0] = new ConcurrentDictionary<string, Instrument>(); instruments[1] = new ConcurrentDictionary<string, Instrument>(); eventOrderUpdated = new AutoResetEvent(false); connected = false; ConnUrl = "https://api.icbit.se:443/?AuthKey=" + authToken + "&UserId=" + userid; sock = new SocketIO(); sock.OnMessage += onMessage; sock.OnJson += onJson; }
public Icbit(uint userid, string apiKey, string apiSecret) { orders = new ConcurrentDictionary<long, Order>(); balance = new ConcurrentDictionary<string, Position>(); instruments = new ConcurrentDictionary<string, Instrument>(); orderToken = 0; connected = false; evtConnected = new AutoResetEvent(false); long nonce = Authenticator.GetUnixTimeStamp(); string signature = Authenticator.GetSignature(nonce, apiKey, apiSecret, userid.ToString()); ConnUrl = String.Format("https://api.icbit.se:443/?key={0}&signature={1}&nonce={2}", apiKey, signature, nonce); sock = new SocketIO(); sock.OnMessage += onMessage; sock.OnJson += onJson; }
void StartMtGoxStreaming() { sock = new SocketIO(); sock.OnMessage += onMessage; sock.OnJson += onJson; sock.Open(@"https://socketio.mtgox.com/", Encoding.ASCII); // choose /mtgox namespace sock.WebSocket.SendAscii("1::/mtgox"); //sock.WebSocket.SendAscii( "4::/mtgox:{\"op\":\"mtgox.subscribe\",\"type\":\"ticker\"}" ); sock.WebSocket.SendAscii("4::/mtgox:{\"op\":\"unsubscribe\",\"channel\":\"dbf1dee9-4f2e-4a08-8cb7-748919a71b21\"}"); // trades sock.WebSocket.SendAscii("4::/mtgox:{\"op\":\"unsubscribe\",\"channel\":\"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe\"}"); // depth //01:45:21.511 DEBUG: DATA: 4::/mtgox:{"op":"subscribe","channel":"dbf1dee9-4f2e-4a08-8cb7-748919a71b21"} //01:45:21.585 DEBUG: DATA: 4::/mtgox:{"op":"subscribe","channel":"d5f06780-30a8-4a48-a2f8-7ed181b4a13f"} //01:45:21.587 DEBUG: DATA: 4::/mtgox:{"op":"subscribe","channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe"} }