bandl package¶
Submodules¶
bandl.angel_broking module¶
bandl.binance module¶
-
class
bandl.binance.
Binance
(api_key=None, api_secret=None, timeout=5, max_retries=2)[source]¶ Bases:
object
-
get_data
(symbol, start=None, end=None, periods=None, interval='1D', dayfirst=False)[source]¶ Binance getData API for intraday/Historical data
- Parameters
symbol (string) – crypto symbol
start (string optional) – start time, defaults to None
end (string, optional) – end time, defaults to None
periods (integer, optional) – No of days, defaults to None
interval (string, optional) – timeframe, defaults to “1D”
dayfirst (bool, optional) – if date in european style, defaults to False
- Raises
ValueError – invalid time
Exception – for execption
- Returns
data requested
- Return type
pandas.DataFrame
-
bandl.coinbase module¶
-
class
bandl.coinbase.
Coinbase
(api_key=None, api_secret=None, timeout=5, max_retries=2)[source]¶ Bases:
object
-
get_data
(symbol, start=None, end=None, periods=None, interval='1D', dayfirst=False)[source]¶ Coinbase getData API for intraday/Historical data
- Parameters
symbol (string) – crypto symbol
start (string optional) – start time, defaults to None
end (string, optional) – end time, defaults to None
periods (integer, optional) – No of days, defaults to None
interval (string, optional) – timeframe, defaults to “1D”
dayfirst (bool, optional) – if date in european style, defaults to False
- Raises
ValueError – invalid time
Exception – for execption
- Returns
data requested
- Return type
pandas.DataFrame
-
-
class
bandl.coinbase.
CoinbaseUrl
[source]¶ Bases:
object
-
get_candle_data_url
(symbol, start, end, interval, dayfirst=False)[source]¶ The granularity field must be one of the following values: {60, 300, 900, 3600, 21600, 86400}. Otherwise, your request will be rejected. These values correspond to timeslices representing one minute, five minutes, fifteen minutes, one hour, six hours, and one day, respectively.
-
bandl.five_paisa module¶
bandl.nasdaq module¶
-
class
bandl.nasdaq.
Nasdaq
(timeout=5, max_retries=2, cloud_mode=False)[source]¶ Bases:
object
Nasdaq class to get data from nasdaq
-
get_data
(symbol, start=None, end=None, periods=None, dayfirst=False)[source]¶ get_data API to fetch data from nasdaq
- Parameters
symbol (string) – stock symbol
start (string, optional) – start date, defaults to None
end (string, optional) – end date, defaults to None
periods (integer, optional) – number of days, defaults to None
dayfirst (bool, optional) – True if date format is european style DD/MM/YYYY, defaults to False
- Raises
ValueError – for invalid inputs
Exception – incase if no data found
- Returns
stock data
- Return type
pandas.DataFrame
-
bandl.nse_data module¶
-
class
bandl.nse_data.
NseData
(timeout=5, max_retries=3)[source]¶ Bases:
object
-
get_data
(symbol, series='EQ', start=None, end=None, periods=None, dayfirst=False)[source]¶ To get NSE stock data
- Parameters
symbol (string) – stock/index symbol
series (string, optional) – segment, defaults to “EQ”
start (string, optional) – start date, defaults to None
end (string, optional) – end date, defaults to None
periods (interger, optional) – number of days, defaults to None
dayfirst (bool, optional) – True if date format is european style DD/MM/YYYY, defaults to False
- Raises
Exception – NSE Connection Related
- Returns
stock data
- Return type
pandas.DataFrame
-
get_oc_exp_dates
(symbol)[source]¶ get current available expiry dates
- Parameters
symbol (string) – stock/index symbol
- Raises
Exception – NSE connection related
- Returns
expiry dates
- Return type
list
-
get_oc_strike_prices
(symbol, format=True, level=3)[source]¶ To get options strike prices or in OTM,ITM,ATM format
- Parameters
symbol (string) – stock/index symbol
format (bool, optional) – format in OTM,ITM,ATM, defaults to True
level (int, optional) – level of strike prices for ITM/OTM, defaults to 3
- Raises
Exception – NSE connection related
- Returns
strike prices
- Return type
list/dictionary
-
get_option_chain_df
(symbol, expiry_date=None, dayfirst=False)[source]¶ This function fetches option chain data from NSE and returns in pandas.DataFrame
- Parameters
symbol (string) – stock/index symbol
expiry_date (string) – expiry date (all date formats accepted), defaults to next near
dayfirst (bool, optional) – True if date format is european style DD/MM/YYYY, defaults to False
- Raises
Exception – NSE connection related
Exception – In html parsing
- Returns
option chain
- Return type
pandas.DataFrame
-
get_option_chain_excel
(symbol, expiry_date=None, dayfirst=False, file_path=None, is_use_default_name=True)[source]¶ Fetches NSE option chain data and returns in the form of excel (.xlsx)
- Parameters
symbol (string) – stock/index symbol
expiry_date (string) – expiry date (all date formats accepted), defaults to next near
dayfirst (bool, optional) – True if date format is european style DD/MM/YYYY, defaults to False
file_path (string, optional) – file/folder path, defaults to None
is_use_default_name (bool, optional) – to get filename as current timestamp, defaults to True
- Raises
Exception – NSE connection related
-
get_option_data
(symbol, expiry_date=None, strikes=None)[source]¶ get option data
- Parameters
symbol (string) – stock/index symbol
expiry_date (string, optional) – expiry date (all date formats accepted), defaults to next near
strikes (Dictionary, optional) – Dictionary having OTM,ITM,ATM strikes, defaults to None
- Raises
Exception – Connection related
- Returns
underlying_val, option data
- Return type
pair
-
get_part_oi_df
(start=None, end=None, periods=None, dayfirst=False, workers=None)[source]¶ Return dictionary of participants containing data frames
- Parameters
start (string, optional) – start date , defaults to None
end (string, optional) – end date, defaults to None
periods (interger, optional) – number of days, defaults to None
dayfirst (bool, optional) – True if date format is european style DD/MM/YYYY, defaults to False
workers (interger, optional) – Number of threads for requesting nse, defaults to None
- Raises
Exception – NSE Connection/Request overload
- Returns
participant wise open interest
- Return type
pandas.DataFrame
-
bandl.samco module¶
-
class
bandl.samco.
Samco
(user_id, password, yob, timeout=5, max_retries=2)[source]¶ Bases:
object
-
get_data
(symbol, start=None, end=None, periods=None, interval='1D', dayfirst=False)[source]¶ Samco getData API for intraday/Historical data
- Parameters
symbol (string) – stock symbol
start (string optional) – start time, defaults to None
end (string, optional) – end time, defaults to None
periods (integer, optional) – No of days, defaults to None
interval (string, optional) – timeframe, defaults to “1D”
dayfirst (bool, optional) – if date in european style, defaults to False
- Raises
ValueError – invalid time
Exception – for execption
- Returns
data requested
- Return type
pandas.DataFrame
-
bandl.yfinance module¶
-
class
bandl.yfinance.
Yfinance
(timeout=5, max_retries=3)[source]¶ Bases:
object
-
get_data
(symbol, is_indian=True, start=None, end=None, periods=None, dayfirst=False)[source]¶ get_data API to fetch data from nasdaq
- Parameters
symbol (string) – stock symbol
start (string, optional) – start date, defaults to None
end (string, optional) – end date, defaults to None
is_indian (bool, optional) – False if stock is not from indian market , defaults to True
periods (integer, optional) – number of days, defaults to None
dayfirst (bool, optional) – True if date format is european style DD/MM/YYYY, defaults to False
- Raises
ValueError – for invalid inputs
Exception – incase if no data found
- Returns
stock data
- Return type
pandas.DataFrame
-