tastytrade / tastytrade-api-js Goto Github PK
View Code? Open in Web Editor NEWJavascript sdk for the tastytrade api
License: MIT License
Javascript sdk for the tastytrade api
License: MIT License
Any possibility to get types added to all of the service functions? Right now they are all Promise<any>
so it requires the user of this sdk to implement all of their own types and models which does not seem ideal.
npm WARN deprecated @types/[email protected]: This is a stub types definition for axios (https://github.com/mzabriskie/axios). axios provides its own type definitions, so you don't need @types/axios installed!
We set the User-Agent
header explicitly in the http-client here. This is ok for node.js and other server side environments, however setting the User-Agent
header in browser environment triggers below warnings:
I am unsure of the significance of User-Agent
for the backend; but maybe, we can just remove the UA from the http client?
The current JS SDK is distributed to NPM with ES5 target. This is very antiquated method as argued here and here.
Almost all the applications which use TastyTrade SDK will likely also use DXLink Websocket Client which is also authored as modern javascript module on NPM - See reference tsconfig.json
Can we target modern runtimes for JS SDK for Tasty Trade APIs?
If the is willing to support this feature, I can even attempt to submit a PR to that effect.
Refer to the API documentation: https://developer.tastytrade.com/streaming-account-data/#available-actions
Action "connect" is for subscribing all account-related notifications. It doesn't work in Sandbox. "account-subscribe" works.
I'm not sure if this is only an issue in Sandbox. I haven't tried in production environment.
Hopefully I just missed it but there does not seem to be a way to throttle data streaming.
The dxfeed docs mentions a FEED_SETUP Configuration message but I can't seem to find it in tastytrade-api-js.
Any ideas on how to throttle data steam?
This SDK offers a MarketDataStreamer which acts as a wrapper and abstraction over dxlink feed apis. However, DXLink team provides their own version of this here.
This raises questions on duplication of efforts, purpose of this SDK over the one provided by DXLink, the difference between the two SDKs and the future vision of Tasty on the SDK. Maybe, we should consider deprecating this version in favor of the one provided by DXLink?
The api quote token only has equities market data available to it. Subscribing to other instruments types via dxLink (equity options, future options, futures) doesn't return any data.
We are aware of the issue and are working with DxFeed to resolve it. Any developments will be posted here.
I want to subscribe to market data on options symbols and get the latest events, even when markets are closed. I'm looking for a snapshot of data rather than a real-time stream.
The tasty platform always shows the latest Greeks, quotes, etc, for the option symbols.
Looking at wss://tasty-demo-ws.dxfeed.com/delayed events in the browser, I see the usual FEED_DATA even when the options market is closed.
{"type":"FEED_DATA","channel":1,"data":["Greeks",["Greeks",".PLTR231117C15",0.859042135169914,0.679454583347139,0.0982083687887286,-0.0261660721057656,0.00609448239509639,0.01518018285523352,"Greeks",".WBA231117P27.5",0.74595897321041,-0.851562819473887,0.0539648651528887,-0.01993263273054975,-0.0167382063515774,0.01331688462849462]]} 1698104164.7325706
The API client behaves differently:
this.streamer.addSubscription( '.PLTR231117C15', {subscriptionTypes: [MarketDataSubscriptionType.Trade], channelId: 1})
would not produce any data
this.streamer.addSubscription( 'AAPL', {subscriptionTypes: [MarketDataSubscriptionType.Quote], channelId: 1})
shows data arriving
I couldn't find anything obvious in the API client implementation that may prevent receiving data outside of the window for opened markets.
Hi,
I'm following the quick start in the README:
import TastytradeClient from "@tastytrade/api"
const tastytradeClient = new TastytradeClient(baseUrl, accountStreamerUrl)
const loginResponse = await tastytradeClient.sessionService.login(usernameOrEmail, pasword)
I'm getting this error message:
const tastytradeClient = new TastytradeClient(baseUrl, accountStreamerUrl)
^
TypeError: TastytradeClient is not a constructor
The baseUrl I'm using is the sandbox page.
I'm on "@tastytrade/api": "^3.1.0",
I'm on node v21.5
I'm also trying to incorporate it with express and use it in a route.
Let me know what other information you need
I am getting consistent 401 for all API requests after #28. It appers that the code change in this PR has a missing return statement.
Readme says I should use DxFeed's api. Do I need a separate dxfeed subscribtion or I can use tastytrade credentials somehow?
Hi there,
I'm trying to stream account data.
I'm working in the Sandbox environment at the moment.
I'm implementing a Typescript, Node, Express server. I'm not using the Tasty Trade JS Library, am using regular webhooks.
I send in this:
Added to JSON and sending: {
action: 'connect',
value: '5W.....',
'request-id': 4,
source: 'tastytrade-api-js-sdk',
'auth-token': 'hS-tazdJq3a5Bus-...'
}
I'm getting this error:
HandleOneMessage JSON: {
status: 'error',
action: 'connect',
'web-socket-session-id': 'c69d0c31',
message: 'not-implemented',
'request-id': 4
}
I have tried the Tasty Trade API JS website example as well and I also get this:
{
"status": "error",
"action": "connect",
"web-socket-session-id": "6964b9ef",
"message": "not-implemented",
"request-id": 2
}
Is the Account Streaming not available right now? I know Tasty Trade is going through some API changes.
I tested it and can get `equity option` quotes and `future options` quotes.
interestingly, I can get option quotes for `SPX`, but not for `SPX` itself.
`greeks` seem not to work
Originally posted by @zlymeda in #7 (comment)
I found out that getting the wss URL and the token for DXlink is not working with the information obtained from endpoint /api-quote-tokens. In the Tasty Trade Postman collection I found there is another endpoint which allows to obtain dxlink token as well as a different wss URL and those are working. Endpoint is /quote-streamer-tokens
Can someone look into this? Change is needed here:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.