8000 Add Missing Fields for Universal Snapshots by HunterL · Pull Request #201 · polygon-io/client-js · GitHub
[go: up one dir, main page]

Skip to content

Add Missing Fields for Universal Snapshots #201

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

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

HunterL
Copy link
Contributor
@HunterL HunterL commented Sep 10, 2024

First commit Closes #200
Issue:
The universal snapshot endpoint returns a last_quote field, which subsequently should have ask_exchange and bid_exchange fields for asset classes like Forex. See example api call:
https://api.polygon.io/v3/snapshot?ticker.any_of=C:USDJPY&limit=1&apiKey=...

{
    "results": [
        {
            "market_status": "open",
            "name": "United States dollar - Japanese yen",
            "ticker": "C:USDJPY",
            "type": "fx",
            "session": {
                "change": -1.35,
                "change_percent": -0.929,
                "close": 144.004,
                "high": 145.551,
                "low": 143.994,
                "open": 145.361,
                "volume": 172978,
                "previous_close": 145.36
            },
            "last_quote": {
                "last_updated": 1725469522000000000,
                "timeframe": "REAL-TIME",
                "ask": 144.02,
                "ask_exchange": 48,
                "bid": 144.01,
                "bid_exchange": 48,
                "exchange": 48
            }
        }
    ]
}

Second commit closes #191
Using an API key that has FMV we can see the fmv field in the results, at the very bottom

{
    "results": [
        {
            "market_status": "open",
            "name": "SPDR S&P 500 ETF Trust",
            "ticker": "SPY",
            "type": "stocks",
            "session": {
                "change": 0.6,
                "change_percent": 0.11,
                "early_trading_change": 0,
                "early_trading_change_percent": 0,
                "close": 546.853,
                "high": 548.627,
                "low": 543.482,
                "open": 548.36,
                "volume": 20235687,
                "previous_close": 546.41,
                "price": 547.01
            },
            "last_quote": {
                "last_updated": 1725990045418145300,
                "timeframe": "REAL-TIME",
                "ask": 547.03,
                "ask_size": 1,
                "ask_exchange": 15,
                "bid": 546.99,
                "bid_size": 1,
                "bid_exchange": 15
            },
            "last_trade": {
                "last_updated": 1725990044387059500,
                "timeframe": "REAL-TIME",
                "id": "56385696856377",
                "price": 547.01,
                "size": 10,
                "exchange": 15,
                "conditions": [
                    37
                ]
            },
            "fmv": 546.987
        }
    ],
}

@HunterL HunterL marked this pull request as ready for review September 10, 2024 17:28
@HunterL HunterL changed the title add ask and bid exchange fields to last quote for universal snapshots Add Missing Fields for Universal Snapshots Sep 10, 2024
Copy link
Contributor
@justinpolygon justinpolygon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@justinpolygon justinpolygon merged commit 24ee29e into master Oct 3, 2024
@justinpolygon justinpolygon deleted the hunter.ask-bid-exchange branch October 3, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants
0