Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
fixes #161
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Dec 10, 2020
1 parent 564c612 commit c956ee9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyEX/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@
internationalExchangesDF,
sectors,
sectorsDF,
search,
searchDF,
tags,
tagsDF,
)
Expand Down
4 changes: 4 additions & 0 deletions pyEX/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@
internationalExchangesDF,
sectors,
sectorsDF,
search,
searchDF,
tags,
tagsDF,
)
Expand Down Expand Up @@ -843,6 +845,8 @@
("internationalExchangesDF", internationalExchangesDF),
("sectors", sectors),
("sectorsDF", sectorsDF),
("search", search),
("searchDF", searchDF),
("tags", tags),
("tagsDF", tagsDF),
# Markets
Expand Down
1 change: 1 addition & 0 deletions pyEX/refdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@
internationalExchangesDF,
)
from .sectors import sectors, sectorsDF, tags, tagsDF
from .search import search, searchDF
27 changes: 27 additions & 0 deletions pyEX/refdata/search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
import pandas as pd
from functools import wraps
from ..common import _interval, _getJson


@_interval(hours=24) # TODO make this smaller?
def search(fragment, token="", version="", filter=""):
"""Returns an array of symbols up to the top 10 matches. Results will be sorted for relevancy. Search currently defaults to equities only, where the symbol returned is supported by endpoints listed under the Stocks category.
https://iexcloud.io/docs/api/#search
Args:
fragment (str): URL encoded search string. Currently search by symbol or security name.
token (str): Access token
version (str): API version
filter (str): filters: https://iexcloud.io/docs/api/#filter-results
Returns:
dict or DataFrame: result
"""
return _getJson("search/{}".format(fragment), token, version, filter)


@wraps(search)
def searchDF(fragment, token="", version="", filter=""):
return pd.DataFrame(search(fragment, token, version, filter))

0 comments on commit c956ee9

Please sign in to comment.