-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add phoenix subscriber #444
Add phoenix subscriber #444
Conversation
sdk/package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@drift-labs/sdk", | |||
"version": "2.25.0", | |||
"version": "2.26.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lmk if you prefer 2.25.1
sdk/src/phoenix/phoenixSubscriber.ts
Outdated
this.subscribed = true; | ||
} | ||
|
||
public getBestBid(): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having this return the price in human readable units. Lmk if you prefer something different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and getBestAsk
should be in PRICE_PRECISION
to be consistent with SerumSubscriber
protocol-v2/sdk/src/serum/serumSubscriber.ts
Line 112 in 006b269
return new BN(bestAsk[0] * PRICE_PRECISION.toNumber()); |
sdk/src/phoenix/phoenixSubscriber.ts
Outdated
this.subscribed = true; | ||
} | ||
|
||
public getBestBid(): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and getBestAsk
should be in PRICE_PRECISION
to be consistent with SerumSubscriber
protocol-v2/sdk/src/serum/serumSubscriber.ts
Line 112 in 006b269
return new BN(bestAsk[0] * PRICE_PRECISION.toNumber()); |
sdk/src/phoenix/phoenixSubscriber.ts
Outdated
this.marketCallbackId = await this.accountLoader.addAccount( | ||
this.marketAddress, | ||
(buffer, slot) => { | ||
this.marketCallbackId = slot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think you meant to update this.lastSlot
here
sdk/src/phoenix/phoenixSubscriber.ts
Outdated
this.clockCallbackId = await this.accountLoader.addAccount( | ||
SYSVAR_CLOCK_PUBKEY, | ||
(buffer, slot) => { | ||
this.clockCallbackId = slot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think you meant to update this.lastSlot
here
* Add phoenix subscriber * Address PR comments
* inital L2 and L3 methods * vamm order prototype * l2 orderbook uses vamm * simplify the getL2 and getL3 function signatures * getL2/getL3 methods on DLOBSubscriber * tweak L2/L3 types * work for serum * tweak imports * fix falsey check * add http status code if DLOBApiClient fails * v2.26.0-beta.0 * ts-sdk: add @ellipsis-labs/phoenix-sdk * Add phoenix subscriber (#444) * Add phoenix subscriber * Address PR comments * update CHANGELOG.md * v2.26.0-beta.1 * program: check max_token_deposits at the end of fill_spot_order (#441) * bigz/spot-fill-max-check * address feedback bugs * CHANGELOG --------- Co-authored-by: Chris Heaney <chrisheaney30@gmail.com> * program: fix overflow error in if staking math (#443) * bigz/fix-large-insurance-math-error * update CHANGELOG.md * CHANGELOG * fix warning * jsdocs * use getMakerLimitBids/Asks for now --------- Co-authored-by: wphan <william@drift.trade> Co-authored-by: Jarry Xiao <61092285+jarry-xiao@users.noreply.github.com> Co-authored-by: bigzPubkey <zane@lunoho.company>
Output from the example file: