2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
IB: Error 075: Difficulty with a specific future (6J, JY, JPY)
#470343
01/09/18 13:41
01/09/18 13:41
|
Joined: Feb 2017
Posts: 20
Gloria
OP
Newbie
|
OP
Newbie
Joined: Feb 2017
Posts: 20
|
Hi, I'd be most grateful if you could help me with the Japanese Yen future. This is "JPY, Future, March 2018" at IB, "6J" at the Globex or the FX-future "JY" at Bloomberg. I have live data and can indeed trade the contract in a simulated account using the IB TWS. Zorro, however, produces an error when I try to trade that contract. Here is a test case.
#include <stdio.h>
#include <r.h>
static int count = 0;
function run () {
if (is (INITRUN)) {
Verbose = 7;
History = ".t6";
LookBack = 100;
BarPeriod = 1;
TimeFrame = 1;
TickTime = 1;
StartDate = 2016;
EndDate = 2017;
asset ("JPY-FUT-20180319-6J-GLOBEX-USD");
brokerCommand (SET_PRICETYPE,2); // use trade rather than bid/ask
Entry = 0;
Stop = 0;
TakeProfit = 0;
Trail = 0;
Margin = 0.0001; // position size is not controlled by margin
Risk = 0; // position size is not controlled by risk limit
Lots = 1;
LotAmount = 12500000*0.0088;
PIP = 0.0000005;
PIPCost = 6.25;
MarginCost = Margin/Lots;
count = 0;
return;
}
if (wdate (NOW) - wdate () < 1.0/(24*60)) {
count++;
printf ("nL %04d-%02d-%02d %02d:%02d:%02d USDJPY O=%.6f, H=%.6f, L=%.6f, C=%.6f [count %d]",
year (),month (),day (),hour (),minute (),(int)floor (second ()),
priceOpen (),priceHigh(),priceLow(),priceClose (),count);
if (count == 3) {
enterLong ();
}
if (count == 5) {
exitLong ();
}
} else {
printf ("nB %04d-%02d-%02d %02d:%02d:%02d USDJPY O=%.6f, H=%.6f, L=%.6f, C=%.6f",
year (),month (),day (),hour (),minute (),(int)floor (second ()),
priceOpen (),priceHigh(),priceLow(),priceClose ());
}
}
Zorro gets plausible minute bars, and so the instrument specification seems to be correct. In Zorro, I get the output
[584: Tue 18-01-09 13:13] 0.0089140/0.0089150 .0089140/0.0089145
B 2018-01-09 13:13:00 USDJPY O=0.008914, H=0.008915, L=0.008914, C=0.008914
[585: Tue 18-01-09 13:15] 0.0089145/0.0089145 .0089145/0.0089145
L 2018-01-09 13:15:01 USDJPY O=0.008915, H=0.008915, L=0.008915, C=0.008915 [count 1]
[586: Tue 18-01-09 13:16] 0.0089177/0.0089177 .0089177/0.0089177
L 2018-01-09 13:16:01 USDJPY O=0.008918, H=0.008918, L=0.008918, C=0.008918 [count 2]
[587: Tue 18-01-09 13:17] 0.0089214/0.0089214 .0089214/0.0089214
L 2018-01-09 13:17:06 USDJPY O=0.008921, H=0.008921, L=0.008921, C=0.008921 [count 3]
Enter 1L JPY-FUT-2018031 at 13:17:06
BrokerBuy JPY-FUT-20180319-6J-GLOBEX-USD: 156 ms
Error 075 ((JPY-FUT-2018031::L)): Can't open 1@0.0089214 at 13:17:06
[588: Tue 18-01-09 13:18] 0.0089256/0.0089256 .0089256/0.0089256
L 2018-01-09 13:18:01 USDJPY O=0.008926, H=0.008926, L=0.008926, C=0.008926 [count 4]
[589: Tue 18-01-09 13:19] 0.0089160/0.0089261 .0089160/0.0089261
L 2018-01-09 13:19:01 USDJPY O=0.008916, H=0.008926, L=0.008916, C=0.008926 [count 5]
Why cannot I open the position? The IB API log file at c:\Jts\something.Day.log says
14:17:05:176 <- 1-11-33911-0-JPY-FUT-20180319-0---GLOBEX--USD--6J-0--1--
14:17:05:208 -> 1-6-33911-1-0.0089145-29--1-1-6-33911-2-0.0089150-21--1-
14:17:09:872 -> 57-1-33910-
14:17:12:181 <- 3-43-33912-0-JPY-FUT-20180319-0---GLOBEX--USD--6J---BUY-110000-MKT-0--DAY---O-0-Zorro-1-0-0-0-0-0-1-0--0-------0---1-0---0-110000--1-1--0------0-----0-----------0---0-0---0--
14:17:12:212 -> 4-2-33912-2109-Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.-
14:17:12:274 -> 5-32-33912-132757349-JPY-FUT-20180319-0-?-12500000-GLOBEX-USD-6JH8-6J-BUY-110000-MKT-0.008915-0.0-DAY--DU640042-O-0-Zorro-101-903574924-0-0-0--903574924.-1/DU640042/100---------0---1-0-------0-0-0-110000-3-1-1--0-0--0-None--0----?-0-0--0-0------0-0-0-----0--IB-0-0--0-Inactive-1.7976931348623157E308-1.7976931348623157E308-1.7976931348623157E308------3-6-33912-Inactive-0-110000-0-903574924-0-0-101--
14:17:12:321 -> 4-2-33912-201-Order rejected - reason:YOUR ORDER IS NOT ACCEPTED. IN ORDER TO OBTAIN THE DESIRED POSITION YOUR NET LIQ [45696.99 EUR] MUST EXCEED THE MARGIN REQ [362973184.28 EUR]-
14:17:12:321 -> 5-32-33912-132757349-JPY-FUT-20180319-0-?-12500000-GLOBEX-USD-6JH8-6J-BUY-110000-MKT-0.008915-0.0-DAY--DU640042-O-0-Zorro-101-903574924-0-0-0--903574924.-1/DU640042/100---------0---1-0-------0-0-0-110000-3-1-1--0-0--0-None--0----?-0-0--0-0------0-0-0-----0--IB-0-0--0-Inactive-1.7976931348623157E308-1.7976931348623157E308-1.7976931348623157E308------3-6-33912-Inactive-0-110000-0-903574924-0-0-101--
14:17:12:337 <- 4-1-33912-
14:17:12:337 -> 4-2-33912-161-Cancel attempted when order is not in a cancellable state. Order permId =903574924-
14:17:12:337 <- 1-11-33913-0-JPY-FUT-20180319-0---GLOBEX--USD--6J-0--1--
14:17:12:384 -> 1-6-33913-1-0.0089145-29-1-
Somehow the trade parameters are wrong here because the margin requirement in the API error message does not make sense. I want to buy only one contract, and it seems this is what Zorro is trying. When I click on the bid or the ask price in the TWS, can trade +1 or -1 contract without any problem. I use Zorro S with the 1.74 beta version (because I eventually need time series with the traded prices rather than bid/ask). Any help would be much appreaciated. Kind regards, gloria
|
|
|
|