Skip to content

Commit

Permalink
docs updates
Browse files Browse the repository at this point in the history
  • Loading branch information
quantfreedom committed Dec 11, 2023
1 parent 6ba7a05 commit 4f35162
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 175 deletions.
4 changes: 1 addition & 3 deletions qf_docstring.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ Summary
-------
{{summaryPlaceholder}}

Explainer Video
---------------
Coming Soon but if you want/need it now please let me know in discord or telegram and i will make it for you
[Explainer Video]()

{{#parametersExist}}
Parameters
Expand Down
20 changes: 20 additions & 0 deletions quantfreedom/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from dash import Dash
from dash_bootstrap_templates import load_figure_template
from jupyter_dash import JupyterDash
from IPython import get_ipython
import dash_bootstrap_components as dbc

load_figure_template("darkly")
dbc_css = "https://cdn.jsdelivr.net/gh/AnnMarieW/dash-bootstrap-templates/dbc.min.css"
try:
shell = str(get_ipython())
if "ZMQInteractiveShell" in shell:
app = JupyterDash(__name__, external_stylesheets=[dbc.themes.DARKLY, dbc_css])
elif shell == "TerminalInteractiveShell":
app = JupyterDash(__name__, external_stylesheets=[dbc.themes.DARKLY, dbc_css])
else:
app = Dash(__name__, external_stylesheets=[dbc.themes.DARKLY, dbc_css])
except NameError:
app = Dash(__name__, external_stylesheets=[dbc.themes.DARKLY, dbc_css])

bg_color = "#0b0b18"
61 changes: 4 additions & 57 deletions quantfreedom/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class IncreasePositionTypeT(NamedTuple):
Parameters
----------
AmountEntrySize : int = 0
AmountEntrySize : int= 0
How much you want your position size to be per trade in USDT
PctAccountEntrySize : int = 1
If you have an equity of 1000 and you want your pct account entry size to be 1% then that means each trade will be a position size of 10 usdt
Expand Down Expand Up @@ -198,7 +198,7 @@ class BacktestSettings(NamedTuple):
Summary
-------
Settings for filtering the results of your backtest. The main purpose of this is to save on memory and also there is sometimes no point in wanting to see strategies that are negative gains or below a specific qf score because they are useless.
Parameters
----------
array_size : int = 10000
Expand All @@ -209,46 +209,16 @@ class BacktestSettings(NamedTuple):
Will not record any strategies whos total trades result is below total trades filter.
qf_filter : float = -np.inf
Will not record any strategies whos qf score result is below the qf filter. qf_score is between -1 to 1,
"""

array_size: int = 10000
gains_pct_filter: float = -np.inf
total_trade_filter: int = -1
qf_filter: float = -np.inf


class DynamicOrderSettingsArrays(NamedTuple):
"""
Summary
-------
_summary_
Parameters
----------
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
NamedTuple : _type_
_description_
"""
max_equity_risk_pct: np.array
max_trades: np.array
risk_account_pct_size: np.array
Expand Down Expand Up @@ -279,17 +249,6 @@ class DynamicOrderSettings(NamedTuple):


class ExchangeSettings(NamedTuple):
"""
Summary
-------
_summary_
Parameters
----------
NamedTuple : _type_
_description_
"""
limit_fee_pct: float = None
max_leverage: float = None
market_fee_pct: float = None
Expand All @@ -304,7 +263,6 @@ class ExchangeSettings(NamedTuple):
leverage_tick_step: int = None



class OrderResult(NamedTuple):
average_entry: np.float_ = np.nan
can_move_sl_to_be: np.bool_ = False
Expand All @@ -324,17 +282,6 @@ class OrderResult(NamedTuple):


class StaticOrderSettings(NamedTuple):
"""
Summary
-------
_summary_
Parameters
----------
NamedTuple : _type_
_description_
"""
increase_position_type: int
leverage_strategy_type: int
pg_min_max_sl_bcb: str
Expand Down
27 changes: 27 additions & 0 deletions quantfreedom/exchanges/apex_exchange/apex.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,33 @@ def get_candles(
until_datetime: datetime = None,
candles_to_dl: int = 200,
):
"""
Summary
-------
[Apex candle docs](https://api-docs.pro.apex.exchange/#publicapi_v2-get-candlestick-chart-data-v2)
Explainer Video
---------------
Coming Soon but if you want/need it now please let me know in discord or telegram and i will make it for you
Parameters
----------
symbol : str
[Use APEX API for symbol list](https://api-docs.pro.apex.exchange/#introduction)
timeframe : str
"1m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "12h", "d", "w"
since_datetime : datetime
The start date, in datetime format, of candles you want to download. EX: datetime(year, month, day, hour, minute)
until_datetime : datetime
The until date, in datetime format, of candles you want to download minus one candle so if you are on the 5 min if you say your until date is 1200 your last candle will be 1155. EX: datetime(year, month, day, hour, minute)
candles_to_dl : int
The amount of candles you want to download
Returns
-------
np.array
a 2 dim array with the following columns "timestamp", "open", "high", "low", "close", "volume"
"""
symbol = symbol.replace("-", "")
ex_timeframe = self.get_exchange_timeframe(ex_timeframes=APEX_TIMEFRAMES, timeframe=timeframe)
timeframe_in_ms = self.get_timeframe_in_ms(timeframe=timeframe)
Expand Down
26 changes: 25 additions & 1 deletion quantfreedom/exchanges/binance_exchange/binance_us.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,31 @@ def get_candles(
candles_to_dl: int = 1500,
):
"""
https://docs.binance.us/#get-candlestick-data
Summary
-------
[Biance US candle docs](https://docs.binance.us/#get-candlestick-data)
Explainer Video
---------------
Coming Soon but if you want/need it now please let me know in discord or telegram and i will make it for you
Parameters
----------
symbol : str
[Use Binance US API for symbol list](https://docs.binance.us/#introduction)
timeframe : str
"1m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "12h", "d", "w"
since_datetime : datetime
The start date, in datetime format, of candles you want to download. EX: datetime(year, month, day, hour, minute)
until_datetime : datetime
The until date, in datetime format, of candles you want to download minus one candle so if you are on the 5 min if you say your until date is 1200 your last candle will be 1155. EX: datetime(year, month, day, hour, minute)
candles_to_dl : int
The amount of candles you want to download
Returns
-------
np.array
a 2 dim array with the following columns "timestamp", "open", "high", "low", "close", "volume"
"""
ex_timeframe = self.get_exchange_timeframe(ex_timeframes=BINANCE_USDM_TIMEFRAMES, timeframe=timeframe)
timeframe_in_ms = self.get_timeframe_in_ms(timeframe=timeframe)
Expand Down
26 changes: 25 additions & 1 deletion quantfreedom/exchanges/binance_exchange/binance_usdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,31 @@ def get_candles(
candles_to_dl: int = 1500,
):
"""
https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data
Summary
-------
[Biance USDM candle docs](https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data)
Explainer Video
---------------
Coming Soon but if you want/need it now please let me know in discord or telegram and i will make it for you
Parameters
----------
symbol : str
[Use Binance USDM API for symbol list](https://binance-docs.github.io/apidocs/futures/en/#general-info)
timeframe : str
"1m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "12h", "d", "w"
since_datetime : datetime
The start date, in datetime format, of candles you want to download. EX: datetime(year, month, day, hour, minute)
until_datetime : datetime
The until date, in datetime format, of candles you want to download minus one candle so if you are on the 5 min if you say your until date is 1200 your last candle will be 1155. EX: datetime(year, month, day, hour, minute)
candles_to_dl : int
The amount of candles you want to download
Returns
-------
np.array
a 2 dim array with the following columns "timestamp", "open", "high", "low", "close", "volume"
"""
ex_timeframe = self.get_exchange_timeframe(ex_timeframes=BINANCE_USDM_TIMEFRAMES, timeframe=timeframe)
timeframe_in_ms = self.get_timeframe_in_ms(timeframe=timeframe)
Expand Down
28 changes: 27 additions & 1 deletion quantfreedom/exchanges/bybit_exchange/bybit.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,33 @@ def get_candles(
category: str = "linear",
):
"""
https://bybit-exchange.github.io/docs/v5/market/kline
Summary
-------
[Bybit candle docs](https://bybit-exchange.github.io/docs/v5/market/kline)
Explainer Video
---------------
Coming Soon but if you want/need it now please let me know in discord or telegram and i will make it for you
Parameters
----------
symbol : str
[Use Bybit API for symbol list](https://bybit-exchange.github.io/docs/v5/intro)
timeframe : str
"1m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "12h", "d", "w"
since_datetime : datetime
The start date, in datetime format, of candles you want to download. EX: datetime(year, month, day, hour, minute)
until_datetime : datetime
The until date, in datetime format, of candles you want to download minus one candle so if you are on the 5 min if you say your until date is 1200 your last candle will be 1155. EX: datetime(year, month, day, hour, minute)
candles_to_dl : int
The amount of candles you want to download
category : str
[Bybit categories link](https://bybit-exchange.github.io/docs/v5/enum#category)
Returns
-------
np.array
a 2 dim array with the following columns "timestamp", "open", "high", "low", "close", "volume"
"""
ex_timeframe = self.get_exchange_timeframe(ex_timeframes=BYBIT_TIMEFRAMES, timeframe=timeframe)
timeframe_in_ms = self.get_timeframe_in_ms(timeframe=timeframe)
Expand Down
23 changes: 9 additions & 14 deletions quantfreedom/exchanges/mufex_exchange/mufex.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def __init__(
else:
self.url_start = "https://api.mufex.finance"

"""
################################################################
################################################################
################### ###################
Expand All @@ -48,7 +47,6 @@ def __init__(
################### ###################
################################################################
################################################################
"""

def __HTTP_post_request(self, end_point, params):
timestamp = str(int(time() * 1000))
Expand Down Expand Up @@ -103,7 +101,6 @@ def __gen_signature(self, timestamp, params_as_string):
hash = hmac.new(bytes(self.secret_key, "utf-8"), param_str.encode("utf-8"), hashlib.sha256)
return hash.hexdigest()

"""
###################################################################
###################################################################
################### ###################
Expand All @@ -113,7 +110,6 @@ def __gen_signature(self, timestamp, params_as_string):
################### ###################
###################################################################
###################################################################
"""

def get_candles(
self,
Expand All @@ -127,8 +123,7 @@ def get_candles(
"""
Summary
-------
https://www.mufex.finance/apidocs/derivatives/contract/index.html?console#t-dv_querykline
[mufex candle docs](https://www.mufex.finance/apidocs/derivatives/contract/index.html?console#t-dv_querykline)
Explainer Video
---------------
Expand All @@ -137,17 +132,17 @@ def get_candles(
Parameters
----------
symbol : str
https://www.mufex.finance/apidocs/derivatives/contract/index.html?console#symbol-symbol
[Mufex Symbol List](https://www.mufex.finance/apidocs/derivatives/contract/index.html?console#symbol-symbol)
timeframe : str
"1m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "12h", "d", "w"
since_timestamp : int, None
The starting date, in milliseconds, of candles you want to download
until_timestamp : int, None
The last date, in milliseconds, of candles you want to download minus one candle so if you are on the 5 min if you say your until date is 1200 your last candle will be 1155
candles_to_dl : int, 1500
since_datetime : datetime
The start date, in datetime format, of candles you want to download. EX: datetime(year, month, day, hour, minute)
until_datetime : datetime
The until date, in datetime format, of candles you want to download minus one candle so if you are on the 5 min if you say your until date is 1200 your last candle will be 1155. EX: datetime(year, month, day, hour, minute)
candles_to_dl : int
The amount of candles you want to download
category : str, "linear"
https://www.mufex.finance/apidocs/derivatives/contract/index.html?console#contract-type-contracttype
category : str
[mufex categories link](https://www.mufex.finance/apidocs/derivatives/contract/index.html?console#contract-type-contracttype)
Returns
-------
Expand Down
Loading

0 comments on commit 4f35162

Please sign in to comment.