oanda / v20-javascript

OANDA v20 bindings for Javascript
MIT License
66 stars 31 forks source link

Uncaught ReferenceError: Price is not defined (pricing.js) #7

Open quantverse opened 5 years ago

quantverse commented 5 years ago

Hello,

the library crashes when attempting to stream prices:

Uncaught ReferenceError: Price is not defined
      at /home/xxx/yyy/zzz/node_modules/@oanda/v20/pricing.js:658:44
      at chunks.forEach.chunk (node_modules/@oanda/v20/context.js:137:33)
      at Array.forEach (<anonymous>)
      at IncomingMessage.response.on.d (node_modules/@oanda/v20/context.js:134:32)
      at addChunk (_stream_readable.js:263:12)
      at readableAddChunk (_stream_readable.js:250:11)
      at IncomingMessage.Readable.push (_stream_readable.js:208:10)
      at HTTPParser.parserOnBody (_http_common.js:139:22)
      at TLSSocket.socketOnData (_http_client.js:440:20)
      at addChunk (_stream_readable.js:263:12)
      at readableAddChunk (_stream_readable.js:250:11)
      at TLSSocket.Readable.push (_stream_readable.js:208:10)
      at TLSWrap.onread (net.js:607:20)

it is apparently missing Price object import, for instance by adding a line:

var Price = require('./pricing_common').Price;
Patafix commented 5 years ago

Same here

lukzard commented 4 years ago

change line 658 in pricing.js with

streamChunkHandler(new ClientPrice(msg));