Skip to content

Commit

Permalink
adapt for qutil compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkrizian committed Jan 22, 2019
1 parent b94b134 commit a72b989
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
21 changes: 10 additions & 11 deletions app/debug.q
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
qib:.Q.def[enlist[`appdir]!enlist`$"app"] .Q.opt .z.x;
system"l ",string[qib`appdir],"/ib.q"
.utl.require"qib/app/ib.q"
syms:("SSSS";enlist csv)0:.Q.dd[.utl.PKGSLOADED"qib"]`app`syms.csv

out"Connecting"
.ib.connect[`$"127.0.0.1";7497;1];
Expand All @@ -16,7 +16,6 @@ subscribe:{[cont]
.ib.nextSubId+:1;
};

syms:("SSSS";enlist csv)0:.Q.dd[hsym qib`appdir;`syms.csv]

serverVersion:{out"Server version: ",string .ib.serverVersion[]};
currentTime:{out"Requesting current time";.ib.reqCurrentTime[]};
Expand Down Expand Up @@ -44,13 +43,13 @@ start:{
serverVersion[];
currentTime[];
TwsConnectionTime[];
/ reqMktData[];
/ reqAccountUpdates[];
/ reqPositions[];
// reqExecutions[];
reqMktData[];
reqAccountUpdates[];
reqPositions[];
reqExecutions[];
reqHistoricalData[];
/ reqAllOpenOrders[];
/ reqContractDetails[];
reqAllOpenOrders[];
reqContractDetails[];
};

started:0b
Expand All @@ -74,5 +73,5 @@ c:(enlist`conId)!enlist 272093
lmtOrder:`action`totalQuantity`orderType`lmtPrice!(`BUY;1000;`LMT;0.01)
mktOrder:`action`totalQuantity`orderType!(`BUY;1000;`MKT)
.ib.placeOrder[1^.ib.nextId;first contract] lmtOrder
.ib.reqMktData[4;cont _`conId;"";0b];
/ .ib.placeOrder[1^.ib.nextId;first contract] lmtOrder
/ .ib.reqMktData[4;cont _`conId;"";0b];
3 changes: 2 additions & 1 deletion app/ib.q
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.utl.require"qib"

out:{-1 string[.z.Z]," ",x;}
zu:{"z"$-10957+x%8.64e4} / kdb+ datetime from unix
format:{ssr[ssr[;"\"";""] .j.j x;",";", "]}

.ib:(`:bin/qib.0.0.1 2:(`LoadLibrary;1))`
.ib.onrecv:{[fname;args] value (enlist $[null func:.ib.callbacks[fname];.ib.unknown;func]),$[type[args] in 10 98 99h;enlist;::] args};
.ib.callbacks:()!()
.ib.unknown:{[fname;args] out" unknown function ",(string fname),", args: ";0N!args}
Expand Down

0 comments on commit a72b989

Please sign in to comment.