Add market metadata, chart quotes, and account graph APIs#6
Open
snacsnoc wants to merge 2 commits intohenryhuangh:mainfrom
Open
Add market metadata, chart quotes, and account graph APIs#6snacsnoc wants to merge 2 commits intohenryhuangh:mainfrom
snacsnoc wants to merge 2 commits intohenryhuangh:mainfrom
Conversation
…_security_status, get_intraday_chart_quotes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a few helpful of Wealthsimple calls I’ve been using in a side project for the last couple months, pulled from browser network traffic and wired into the main client. The helper methods were needed to make them usable from normal ticker input. The main value here is that it fills in a few obvious gaps on the read side without changing auth or order flow.
New functions:
get_markets_metadata()Exchange-level metadata like open/close times and MIC codes
get_market_buffer(country, is_option)Returns the market buffer multiplier Wealthsimple uses
get_security_status(security_id)Returns the current trading status for a security
get_intraday_chart_quotes(...)Returns Wealthsimple-native chart points with timestamps
get_account_current_financials(account_id)Returns current account-level liquidation value, deposits, withdrawals, and returns.
get_account_graph_data(...)Returns the account graph payload used for charting.
parse_ticker_market(),_is_us_exchange(),_is_canadian_exchange(),resolve_security_id()Small glue helpers for inputs like
TSLA.USandWCP.TOParsing the ticker market and market checking were specific to my needs, so not sure if they would be helpful to others.
Overview:
get_intraday_chart_quotes()exposes Wealthsimple's own chart data instead of forcing callers to infer timing from quote snapshots or rely entirely on external feeds.get_account_graph_data()andget_account_current_financials()do the same thing on the account side. Before this, the client had balances and historical financials, but not the broker native graph payload or a clean current financials read for a single account.get_security_status()gives an explicit status check instead of guessing from quote data.The ticker helpers are boring but necessary. If the caller has
TICKER.MARKETinput, they should not have to reimplement symbol parsing and exchange filtering outside the client.The return values are plain dict/list/scalar values.
resolve_security_id()caches hits after the first lookup, and saves an API call (note: spamming the WealthSimple API endpoint with a request every 30 seconds will give you 429s...) I left__typenamein the payloads, stripping it would just add cleanup code for no real gain.README was updated with the new calls.
Example shapes
Since this PR is adding several new features, I've added below some example outputs from the functions just as a reference.
ws.get_markets_metadata()[ { "__typename": "MarketMetadata", "cacheDate": "2026-03-13", "close": "16:00:00", "date": "2026-03-13", "exchangeName": "NASDAQ", "lastOpenDate": "2026-03-12", "lastOpenTime": "09:30:00", "mic": "XNAS", "nextOpenDate": "2026-03-16", "nextOpenTime": "09:30:00", "open": "09:30:00" } ]ws.get_market_buffer(country="CA")1.006ws.get_security_status("sec-s-6e73535b8e474d8689064c4c9fee326a"){ "__typename": "Security", "id": "sec-s-6e73535b8e474d8689064c4c9fee326a", "optionDetails": None, "status": "TRADING" }ws.get_intraday_chart_quotes(...)[ { "__typename": "ChartBarQuote", "currency": "CAD", "marketStatus": "OPEN", "price": "17.1000", "securityId": "sec-s-6e73535b8e474d8689064c4c9fee326a", "sessionPrice": "17.1000", "timestamp": "2026-03-13T13:30:00Z" } ]ws.get_account_current_financials("my-wealthsimple-account-id"){ "__typename": "AccountCurrentFinancials", "id": "my-wealthsimple-account-id-CAD", "netLiquidationValueV2": { "__typename": "Money", "amount": "580.08505", "cents": 58009, "currency": "CAD" }, "netDeposits": { "__typename": "Money", "amount": "954.22", "cents": 95422, "currency": "CAD" }, "simpleReturns": { "__typename": "SimpleReturns", "amount": { "__typename": "Money", "amount": "0.00765", "cents": 1, "currency": "CAD" }, "asOf": None, "rate": "0.000013", "referenceDate": "2026-03-09" } }ws.get_account_graph_data("my-wealthsimple-account-id"){ "previousClose": { "__typename": "HistoricalGraphDataPoint", "dateTime": "2026-03-09T20:00:00.000Z", "netLiquidationValue": { "__typename": "Money", "amount": "580.0774", "currency": "CAD" } }, "data": [ { "__typename": "HistoricalGraphDataPoint", "dateTime": "2026-03-10T13:30:00.000Z", "netDeposits": { "__typename": "Money", "amount": "954.22", "currency": "CAD" }, "netLiquidationValue": { "__typename": "Money", "amount": "580.271", "currency": "CAD" } } ] }ws.resolve_security_id("WCP.TO")"sec-s-ab88ccb65fe24dcc991215e07eea2e41"ws.parse_ticker_market("TSLA.US")ws._is_us_exchange("NASDAQ")Truews._is_canadian_exchange("TSX")True