tastytrade / tastytrade-api-js

Javascript sdk for the tastytrade api
MIT License
67 stars 36 forks source link

Pop50 endpoint #1

Closed OperationalFallacy closed 1 year ago

OperationalFallacy commented 1 year ago

Hi,

I'd like to add a service for pop50 calculations. I put some interfaces to make it easier to work with the service, there may be missing properties since I had to guess them, this API is not documented yet.

I've tested it with a basic integration test: npm run test pop-service I've tried all tests and lots of them fail with https://api.cert.tastyworks.com, perhaps some parameters missing? Not sure. Let me know how to run whole test suite and I'l try.

Thank you! Roman

dmoss18 commented 1 year ago

Thanks @OperationalFallacy.

The README now includes instructions on adding a .env file with data to allow the tests to pass. Rebase your branch to get the latest master changes in.

I will get in touch with the development team about adding pop 50 to the open api. Currently this SDK only supports endpoints that are officially supported by the tastytrade Open Api. You can find all of those endpoints here.

OperationalFallacy commented 1 year ago

Thank you, @dmoss18

The tests can pass for pop-service if I use prod endpoint (https://api.cert.tastyworks.com) and the respective login for only this test. I think this is because cert environment has not /fifty-percent-pop service deployed.

➜  tastytrade-api-js git:(fifty-percent-pop) ✗ npm run test

> @tastytrade/api@1.0.0 test
> jest -i --restoreMocks

 PASS  tests/integration/service/instruments-service.test.ts
 PASS  tests/integration/service/session-service.test.ts
 PASS  tests/integration/service/watchlists-service.test.ts
 PASS  tests/integration/service/accounts-and-customers-service.test.ts
 PASS  tests/integration/service/balances-and-positions-service.test.ts
 PASS  tests/integration/service/pop-service.test.ts
 PASS  tests/integration/service/orders-service.test.ts
 PASS  tests/integration/service/transactions-service.test.ts
 PASS  tests/integration/service/risk-parameters-service.test.ts
 PASS  tests/integration/service/account-status-service.test.ts
 PASS  tests/integration/service/symbol-search-service.test.ts
 PASS  tests/integration/service/margin-requirements-service.test.ts
 PASS  tests/unit/service/session-service.test.ts

Test Suites: 13 passed, 13 total
Tests:       41 passed, 41 total
Snapshots:   0 total
Time:        8.714 s, estimated 9 s
Ran all test suites.

Let me know how you'd like to proceed.

dmoss18 commented 1 year ago

@OperationalFallacy after discussing with the back-end engineers, we aren't going to be adding Pop50 to the open api spec at this time. Thanks for taking the time to work on it, and for your notes on the tests. We'll work on making this easier to run.

Closing this PR.