Roger Posted September 7, 2021 Report Share Posted September 7, 2021 Hello, I am having trouble getting from websocket -- balancesUpdate -- the AvailableFunds:USD value. The colon is creating an error in my javascript code. I can access other websocket data that does not have that colon. I have tried many code variations, with no luck. Examples: This works: addmessages(json.result.accountKey) no colon This does not work: addmessages(json.result.AvailableFunds:USD) the colon causes an error Any suggestions? Thanks, Roger Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted September 7, 2021 Report Share Posted September 7, 2021 the error is with the parser. What broker is this with? Quote Link to comment Share on other sites More sharing options...
Roger Posted September 7, 2021 Author Report Share Posted September 7, 2021 Broker is IB. Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted September 7, 2021 Report Share Posted September 7, 2021 if you change it from : to ~ does the parsing work? Want to know before I make a change Quote Link to comment Share on other sites More sharing options...
Roger Posted September 7, 2021 Author Report Share Posted September 7, 2021 Mr. Medved, I tried addmebal (json.result.AvailableFunds~USD); Still will not work. Thanks. Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted September 7, 2021 Report Share Posted September 7, 2021 you changed the text being parsed to ~ as well, right? basically, need to use some unique separator that will be OK Quote Link to comment Share on other sites More sharing options...
Roger Posted September 7, 2021 Author Report Share Posted September 7, 2021 Both give error in Visual Studio Code and the code will not run. addmebal (json.result.AvailableFunds~USD) addmessages (json.result.AvailableFunds:USD) The underscore _ does not give error in Visual Studio Code, so may work. addmessages (json.result.AvailableFunds_USD) Thanks. 1 Quote Link to comment Share on other sites More sharing options...
Jerry Medved Posted September 7, 2021 Report Share Posted September 7, 2021 we use Newtonsoft.Json which does not have a problem since it does not convert to C# variables, but will make it so : is converted to _ for balances as well as conversions we already do. will send you an update. Quote Link to comment Share on other sites More sharing options...
Roger Posted September 7, 2021 Author Report Share Posted September 7, 2021 Thanks for you assistance. Thanks, Roger Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.