-
Notifications
You must be signed in to change notification settings - Fork 27
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
Usage outside of US #63
Comments
hey @lach1010 many thanks for the kind words 👍
Honestly, this actually sounds true, but I have to admit it's purely coincidental. I just went with some kind of default, but I'm not a even a US user myself. Apart from the StockQuery is_us default, do you see this anywhere else?
Can you share an example? Both marketdata_history_by_symbol and marketdata_history_by_symbols accept StockQuery as its argument, which allows you to disable this behaviour, eg: client.marketdata_history_by_symbols(StockQuery('AAPL', contract_conditions={})) It is mentioned here: That being said, I can see how the code snipped I've just shared is never explicitly shown, nor that this is a nice solution. Thanks for bringing it up.
I'm all in for it! Thank you for spotting these inconsistencies!
I think a global_contract_condition parameter for the class would be a nice solution. This way one could disable this if needed, or alter it to whatever way they want.
Ahh appreciate it - if you're looking to do an easy first-time contribution then you're welcome to, but in all fairness I don't mind doing it myself as it is very straightforward. |
Ah I see. So the default_filtering flag is to apply contract_conditions with is_us:True if contract_conditions is not provided in the query. So currently setting the contract_conditions = {} rather then the default None would be a work around. Yeah I agree that a neater approach would be nice as the current api implies to me that is_us default filtering is a baseline, on top of which a users query filtering is applied, as the flag is still set. Whilst in reality it's just a default only when nothing is provided. The other quirk here is that providing a different contract_condition would loose the default behaviour. Ie specifying the asset type to be a stock would take the filtering from being US based - to anywhere and a stock. Maybe a clarification of this behaviour in the docs would be good. I might leave this one to you whilst I still get my head around what's on offer here, how things are structured and the rationale for choices made thus far. Keen to get involved going forward though if your looking for help. |
Correct 👍
Yes, though I would say this isn't unwanted. If explicit contract_condition passed in StockQuery doesn't override the default, how else would we turn it off? It's either default, or completely overridden by what user passes. So it makes sense that specifying asset type to stock would remove the default contract condition. Indeed, the docs outline it: "A Would you say we could rephrase this to make it clearer?
Sure thing, I'll handle the implementation. I appreciate you helping me out figure out the best way to do this 🙌
Absolutely, I have a few easy tasks to handle for any contributors interested. Drop me an email if you'd be interested: [email protected] |
I'm based in Brisbane/Australia and trade Asia and the US, so trading international stocks from Australia is possible. It sounds like you solved the problem, if not let me know and I'll try to help.
|
I added a global # using stock query field
conids = client.stock_conid_by_symbol(StockQuery('AAPL', contract_conditions={'exchange': 'MEXI'}), default_filtering=False).data
pprint(conids)
# using global flag
client.default_filtering = False
conids = client.stock_conid_by_symbol(StockQuery('AAPL', contract_conditions={'exchange': 'MEXI'})).data
pprint(conids) Please try it out through |
Fantastic. Thanks mate. Will give it a try |
Works great thank you |
Hi Team,
Fantastic work thus far.
I am based outside of the US and looking to use the tool for AUS securities on the ASX Exchange.
Clearly the package has been developed first and foremost with US users at heart, however would be great to see this made just as easy to use globally.
For example the stock_conid_by_symbol function is applying the is_us filter by default, which of course is able to be disabled.
My issue is that downsteam users of the stock_conid_by_symbol api don't necessarily have the ability to disable this behaviour - eg the marketdata_history_by_symbol/s family.
I know this can of course be worked around by the user making separate calls to get the con_id and then get data, but it would be nice for the full API to be geo agnostic.
Immediate options would seem to be to remove the default behaviour; or extend the flag parameter to more of the API, or be able to set a global/client state at initialisation?
Happy to get involved with dev work where it makes sense.
The text was updated successfully, but these errors were encountered: