forked from tkp-archive/pyEX
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tkp-archive#245 from iexcloud/ric-isin
Add ric lookup, separate into own files
- Loading branch information
Showing
7 changed files
with
95 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# ***************************************************************************** | ||
# | ||
# Copyright (c) 2021, the pyEX authors. | ||
# | ||
# This file is part of the pyEX library, distributed under the terms of | ||
# the Apache License 2.0. The full license can be found in the LICENSE file. | ||
# | ||
from functools import wraps | ||
|
||
import pandas as pd | ||
|
||
from ..common import _get | ||
|
||
|
||
def isinLookup(isin, token="", version="stable", filter="", format="json"): | ||
"""This call converts an ISIN to an iex symbol | ||
https://iexcloud.io/docs/api/#isin-mapping | ||
8am, 9am, 12pm, 1pm UTC daily | ||
Args: | ||
isin (str): isin to lookup | ||
token (str): Access token | ||
version (str): API version | ||
filter (str): filters: https://iexcloud.io/docs/api/#filter-results | ||
format (str): return format, defaults to json | ||
Returns: | ||
dict or DataFrame or list: result | ||
""" | ||
return _get( | ||
"ref-data/isin?isin={}".format(isin), | ||
token=token, | ||
version=version, | ||
filter=filter, | ||
format=format, | ||
) | ||
|
||
|
||
@wraps(isinLookup) | ||
def isinLookupDF(*args, **kwargs): | ||
return pd.DataFrame(isinLookup(*args, **kwargs)) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# ***************************************************************************** | ||
# | ||
# Copyright (c) 2021, the pyEX authors. | ||
# | ||
# This file is part of the pyEX library, distributed under the terms of | ||
# the Apache License 2.0. The full license can be found in the LICENSE file. | ||
# | ||
from functools import wraps | ||
|
||
import pandas as pd | ||
|
||
from ..common import _get | ||
|
||
|
||
def ricLookup(ric, token="", version="stable", filter="", format="json"): | ||
"""This call converts a RIC to an iex symbol | ||
https://iexcloud.io/docs/api/#ric-mapping | ||
8am, 9am, 12pm, 1pm UTC daily | ||
Args: | ||
ric (str): ric to lookup | ||
token (str): Access token | ||
version (str): API version | ||
filter (str): filters: https://iexcloud.io/docs/api/#filter-results | ||
format (str): return format, defaults to json | ||
Returns: | ||
dict or DataFrame or list: result | ||
""" | ||
return _get( | ||
"ref-data/ric?ric={}".format(ric), | ||
token=token, | ||
version=version, | ||
filter=filter, | ||
format=format, | ||
) | ||
|
||
|
||
@wraps(ricLookup) | ||
def ricLookupDF(*args, **kwargs): | ||
return pd.DataFrame(ricLookup(*args, **kwargs)) |
This file contains 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
This file contains 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
This file contains 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