Comments (6)
It looks you are getting disconnected by TWS, probably due to pacing issues.
TWS doesn't allow more then 50 requests per second, over any 5 second periods; i.e. 250 req / 5s.
You should check if you are getting any of these error messages:
0 Warning: Approaching max rate of 50 messages per second (48)
or
100 Max rate of messages per second has been exceeded:max=50
After sending error 100
TWS closes the connection immediately.
Workarounds:
- carefully pace requests yourself not to exceed the threshold of 250 req / 5s
- TWS before 10.16: the default behavior is to disconnect when threshold is breached.
UseconnectOptions="+PACEAPI"
when connecting and TWS will automatically pace the requests and avoid disconnections. - TWS 10.16 and later: the default behavior is to automatically pace requests unless option
API -> "Reject messages above maximum allowed message rate vs. applying pacing." is checked.
Ref: IB Release Notes
If running TWS pre 10.16 you might want to consider upgrading to a current version and keep the default behavior.
from jib.jl.
It looks you are getting disconnected by TWS, probably due to pacing issues. TWS doesn't allow more then 50 requests per second, over any 5 second periods; i.e. 250 req / 5s.
You should check if you are getting any of these error messages:
0 Warning: Approaching max rate of 50 messages per second (48) or 100 Max rate of messages per second has been exceeded:max=50
After sending error
100
TWS closes the connection immediately.Workarounds:
* carefully pace requests yourself not to exceed the threshold of 250 req / 5s * TWS before 10.16: the default behavior is to disconnect when threshold is breached. Use `connectOptions="+PACEAPI"` when connecting and TWS will automatically pace the requests and avoid disconnections. * TWS 10.16 and later: the default behavior is to automatically pace requests unless option API -> "Reject messages above maximum allowed message rate vs. applying pacing." is checked.
Ref: IB Release Notes
If running TWS pre 10.16 you might want to consider upgrading to a current version and keep the default behavior.
thank you so much for taking the time.
this code has been working for about 3 months without fault so this behavior started 12/16/22.
I checked the HELP for the TWS desktop I am using as a gateway and the build is 10.20.1f 12/13/22
I don't know how to put connectOptions="+PACEAPI" into my code.
ALSO I can't figure out how to check the log files. I "thought" that the log file was given in launcher.log but now all it says
2022-12-20 21:00:21.540 [SA] INFO [JTS-PostAuthenticateS2-19] - performLogSwitch() [force=false]
2022-12-20 21:00:21.657 [SA] INFO [JTS-PostAuthenticateS2-19] - Switching to a new encrypted log..
from jib.jl.
I don't know how to put connectOptions="+PACEAPI" into my code.
That's an argument of Jib.connect()
, as in:
ib = Jib.connect(4002, 1, "+PACEAPI")
Though, it shouldn't be necessary for TWS 10.20 if
Settings -> API -> "Reject messages above maximum allowed message rate vs. applying pacing." is unchecked.
You should check if you are getting any of these error messages:
0 Warning: Approaching max rate of 50 messages per second (48) or 100 Max rate of messages per second has been exceeded:max=50After sending error
100
TWS closes the connection immediately.
ALSO I can't figure out how to check the log files. I "thought" that the log file was given in launcher.log but now all it says
These messages are not found in launcher.log. TWS sends them directly to your program, which should handle them properly via the callback:
wrap.error(id, errorCode, errorString, advancedOrderRejectJson)
Your wrap.error()
should at least print or save the messages somewhere for diagnostic purposes.
from jib.jl.
I don't know how to put connectOptions="+PACEAPI" into my code.
That's an argument of
Jib.connect()
, as in:ib = Jib.connect(4002, 1, "+PACEAPI")Though, it shouldn't be necessary for TWS 10.20 if Settings -> API -> "Reject messages above maximum allowed message rate vs. applying pacing." is unchecked.
You should check if you are getting any of these error messages:
0 Warning: Approaching max rate of 50 messages per second (48) or 100 Max rate of messages per second has been exceeded:max=50After sending error
100
TWS closes the connection immediately.ALSO I can't figure out how to check the log files. I "thought" that the log file was given in launcher.log but now all it says
These messages are not found in launcher.log. TWS sends them directly to your program, which should handle them properly via the callback:
wrap.error(id, errorCode, errorString, advancedOrderRejectJson)Your
wrap.error()
should at least print or save the messages somewhere for diagnostic purposes.
thank you for the quick reply.
I can confirm that Settings -> API -> "Reject messages above maximum allowed message rate vs. applying pacing." is unchecked.
I have the code from your EXCELLENT example (see below) is this enough to diagnose this issue please?
I could add logging to the code ( which I should have done in the first place).
wrap = Jib.Wrapper(
# These events are always sent
error= (id, errorCode, errorString, advancedOrderRejectJson) -> println("DJ Error: $(something(id, "NA")) $errorCode $errorString $advancedOrderRejectJson"),
REPLACED BY
wrap = Jib.Wrapper(
# These events are always sent
# error= (id, errorCode, errorString, advancedOrderRejectJson) -> println("DJ Error: $(something(id, "NA")) $errorCode $errorString $advancedOrderRejectJson"),
error= (id, errorCode, errorString, advancedOrderRejectJson) -> @info "message : $(now()) : DJ Error: $(something(id, "NA")) $errorCode $errorString $advancedOrderRejectJson" ),
Got to say that it's weird this JUST started happening. I have a raspberry pi monitoring the ISP feed and there are no problems there.
from jib.jl.
That is the wrap.error()
I was referring to.
If the error messages I mentioned above don't show up in your logs then the root problem might be something different than sending too many requests too quickly.
If pacing is not the issue, browsing through your logs might give some clues of what is going on.
You can verify that your application indeed gets unexpectedly disconnected from TWS by checking:
isopen(ib.socket) # = true when connected
or by clicking on DATA
on the upper right corner of the TWS window.
from jib.jl.
problem just went away this morning BUT I am certainly going to go back and do this properly using your advice. Thank you for a wonderful development environment. I can't spend more than a hour a week on this BUT in that hour your code makes a HUGE difference. I learn by example and you REALLY do a great job. Thanks and happy hols to you and yours
from jib.jl.
Related Issues (16)
- Drop support of legacy versions
- Primary Exchange Error - Unsupported Keyword HOT 2
- Unable to parse data. java.lang.NumberFormatException: For input string HOT 3
- Decimal vs floating point data type for sizes
- julia noob needs a little help with Jib asynch HOT 2
- Jib.reqMktData throws e = TypeError: in typeassert, expected Float64, got a value of type Nothing
- Error message "UndefVarError: Execution not defined" HOT 3
- Drop attempt to infer server time zone
- LoadError: [ Info: reader exiting IOError: stream is closed or unusable HOT 1
- historicalData HOT 5
- Unable to connect thru IB Gateway ERROR: EOFError: read end of file HOT 2
- past and future stock options prices ? HOT 1
- "Central Standard Time" should also reference "America/Chicago" HOT 1
- Compatibility with Julia version / enhancements HOT 6
- check_all() blocks on Windows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jib.jl.