%global _empty_manifest_terminate_build 0
Name: python-quick-trade
Version: 7.9.6
Release: 1
Summary: Library for easy management and customization of algorithmic trading.
License: cc-by-sa-4.0
URL: https://pypi.org/project/quick-trade/
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/9b/a9/0d3ff158caea2f161f47785dd8ac0401be6a796343184c71eac48b5ebfc8/quick_trade-7.9.6.tar.gz
BuildArch: noarch
%description
# quick_trade
[](https://vshymanskyy.github.io/StandWithUkraine)
[](https://pepy.tech/project/quick-trade)
[)](https://pepy.tech/project/quick-trade)

```
Dependencies:
├──ta (Bukosabino https://github.com/bukosabino/ta (by Darío López Padial))
├──plotly (https://github.com/plotly/plotly.py)
├──pandas (https://github.com/pandas-dev/pandas)
├──numpy (https://github.com/numpy/numpy)
├──tqdm (https://github.com/tqdm/tqdm)
├──scikit-learn (https://github.com/scikit-learn/scikit-learn)
└──ccxt (https://github.com/ccxt/ccxt)
```
* **Documentation:** 🚧 https://quick-trade.github.io/quick_trade/#/ 🚧
* **Twitter:** [@quick_trade_tw](https://twitter.com/quick_trade_tw)
* **Discord**: [quick_trade](https://discord.gg/SkRg9mzuB5)
# Gitcoin Grant
The [Quadratic Funding](https://vitalik.ca/general/2019/12/07/quadratic.html) formula makes your one dollar grant much more socially valuable.
**[Support quick_trade through Gitcoin](https://gitcoin.co/grants/3876/quick_trade)**.
We will support community by opening bounties from your grants.
[](https://gitcoin.co/grants/3876/quick_trade)
## Installation:
Quick install:
```commandline
$ pip3 install quick-trade
```
For development:
```commandline
$ git clone https://github.com/quick-trade/quick_trade.git
$ pip3 install -r quick_trade/requirements.txt
$ cd quick_trade
$ python3 setup.py install
$ cd ..
```
## Customize your strategy!
```python
from quick_trade.plots import TraderGraph, make_trader_figure
import ccxt
from quick_trade import strategy, TradingClient, Trader
from quick_trade.utils import TradeSide
class MyTrader(qtr.Trader):
@strategy
def strategy_sell_and_hold(self):
ret = []
for i in self.df['Close'].values:
ret.append(TradeSide.SELL)
self.returns = ret
self.set_credit_leverages(2) # if you want to use a leverage
self.set_open_stop_and_take(stop)
# or... set a stop loss with only one line of code
return ret
client = TradingClient(ccxt.binance())
df = client.get_data_historical("BTC/USDT")
trader = MyTrader("BTC/USDT", df=df)
a.connect_graph(TraderGraph(make_trader_figure()))
a.set_client(client)
a.strategy_sell_and_hold()
a.backtest()
```
## Find the best strategy!
```python
import quick_trade as qtr
import ccxt
from quick_trade.tuner import *
from quick_trade import TradingClient
class Test(qtr.ExampleStrategies):
@strategy
def strategy_supertrend1(self, plot: bool = False, *st_args, **st_kwargs):
self.strategy_supertrend(plot=plot, *st_args, **st_kwargs)
self.convert_signal() # only long trades
return self.returns
@strategy
def macd(self, histogram=False, **kwargs):
if not histogram:
self.strategy_macd(**kwargs)
else:
self.strategy_macd_histogram_diff(**kwargs)
self.convert_signal()
return self.returns
@strategy
def psar(self, **kwargs):
self.strategy_parabolic_SAR(plot=False, **kwargs)
self.convert_signal()
return self.returns
params = {
'strategy_supertrend1':
[
{
'multiplier': Linspace(0.5, 22, 5)
}
],
'macd':
[
{
'slow': Linspace(10, 100, 3),
'fast': Linspace(3, 60, 3),
'histogram': Choise([False, True])
}
],
'psar':
[
{
'step': 0.01,
'max_step': 0.1
},
{
'step': 0.02,
'max_step': 0.2
}
]
}
tuner = QuickTradeTuner(
TradingClient(ccxt.binance()),
['BTC/USDT', 'OMG/USDT', 'XRP/USDT'],
['15m', '5m'],
[1000, 700, 800, 500],
params
)
tuner.tune(Test)
print(tuner.sort_tunes())
tuner.save_tunes('quick-trade-tunes.json') # save tunes as JSON
```
You can also set rules for arranging arguments for each strategy by using `_RULES_` and `kwargs` to access the values of the arguments:
```python
params = {
'strategy_3_sma':
[
dict(
plot=False,
slow=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
fast=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
mid=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
_RULES_='kwargs["slow"] > kwargs["mid"] > kwargs["fast"]'
)
],
}
```
## User's code example (backtest)
```python
from quick_trade import brokers
from quick_trade import trading_sys as qtr
from quick_trade.plots import *
import ccxt
from numpy import inf
client = brokers.TradingClient(ccxt.binance())
df = client.get_data_historical('BTC/USDT', '15m', 1000)
trader = qtr.ExampleStrategies('BTC/USDT', df=df, interval='15m')
trader.set_client(client)
trader.connect_graph(TraderGraph(make_trader_figure(height=731, width=1440, row_heights=[10, 5, 2])))
trader.strategy_2_sma(55, 21)
trader.backtest(deposit=1000, commission=0.075, bet=inf) # backtest on one pair
```
## Output plotly chart:

## Output print
```commandline
losses: 12
trades: 20
profits: 8
mean year percentage profit: 215.1878652911773%
winrate: 40.0%
mean deviation: 2.917382949881604%
Sharpe ratio: 0.02203412259055281
Sortino ratio: 0.02774402450236864
calmar ratio: 21.321078596349782
max drawdown: 10.092728860725552%
```
## Run strategy
Use the strategy on real moneys. YES, IT'S FULLY AUTOMATED!
```python
import datetime
from quick_trade.trading_sys import ExampleStrategies
from quick_trade.brokers import TradingClient
from quick_trade.plots import TraderGraph, make_figure
import ccxt
ticker = 'MATIC/USDT'
start_time = datetime.datetime(2021, # year
6, # month
24, # day
5, # hour
16, # minute
57) # second (Leave a few seconds to download data from the exchange)
class MyTrade(ExampleStrategies):
@strategy
def strategy(self):
self.strategy_supertrend(multiplier=2, length=1, plot=False)
self.convert_signal()
self.set_credit_leverages(1)
self.sl_tp_adder(10)
return self.returns
keys = {'apiKey': 'your api key',
'secret': 'your secret key'}
client = TradingClient(ccxt.binance(config=keys)) # or any other exchange
trader = MyTrade(ticker=ticker,
interval='1m',
df=client.get_data_historical(ticker, limit=10))
fig = make_trader_figure()
graph = TraderGraph(figure=fig)
trader.connect_graph(graph)
trader.set_client(client)
trader.realtime_trading(
strategy=trader.strategy,
start_time=start_time,
ticker=ticker,
limit=100,
wait_sl_tp_checking=5
)
```

## Additional Resources
Old documentation (V3 doc): https://vladkochetov007.github.io/quick_trade.github.io
# License

quick_trade by Vladyslav Kochetov is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Permissions beyond the scope of this license may be available at vladyslavdrrragonkoch@gmail.com.
%package -n python3-quick-trade
Summary: Library for easy management and customization of algorithmic trading.
Provides: python-quick-trade
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-quick-trade
# quick_trade
[](https://vshymanskyy.github.io/StandWithUkraine)
[](https://pepy.tech/project/quick-trade)
[)](https://pepy.tech/project/quick-trade)

```
Dependencies:
├──ta (Bukosabino https://github.com/bukosabino/ta (by Darío López Padial))
├──plotly (https://github.com/plotly/plotly.py)
├──pandas (https://github.com/pandas-dev/pandas)
├──numpy (https://github.com/numpy/numpy)
├──tqdm (https://github.com/tqdm/tqdm)
├──scikit-learn (https://github.com/scikit-learn/scikit-learn)
└──ccxt (https://github.com/ccxt/ccxt)
```
* **Documentation:** 🚧 https://quick-trade.github.io/quick_trade/#/ 🚧
* **Twitter:** [@quick_trade_tw](https://twitter.com/quick_trade_tw)
* **Discord**: [quick_trade](https://discord.gg/SkRg9mzuB5)
# Gitcoin Grant
The [Quadratic Funding](https://vitalik.ca/general/2019/12/07/quadratic.html) formula makes your one dollar grant much more socially valuable.
**[Support quick_trade through Gitcoin](https://gitcoin.co/grants/3876/quick_trade)**.
We will support community by opening bounties from your grants.
[](https://gitcoin.co/grants/3876/quick_trade)
## Installation:
Quick install:
```commandline
$ pip3 install quick-trade
```
For development:
```commandline
$ git clone https://github.com/quick-trade/quick_trade.git
$ pip3 install -r quick_trade/requirements.txt
$ cd quick_trade
$ python3 setup.py install
$ cd ..
```
## Customize your strategy!
```python
from quick_trade.plots import TraderGraph, make_trader_figure
import ccxt
from quick_trade import strategy, TradingClient, Trader
from quick_trade.utils import TradeSide
class MyTrader(qtr.Trader):
@strategy
def strategy_sell_and_hold(self):
ret = []
for i in self.df['Close'].values:
ret.append(TradeSide.SELL)
self.returns = ret
self.set_credit_leverages(2) # if you want to use a leverage
self.set_open_stop_and_take(stop)
# or... set a stop loss with only one line of code
return ret
client = TradingClient(ccxt.binance())
df = client.get_data_historical("BTC/USDT")
trader = MyTrader("BTC/USDT", df=df)
a.connect_graph(TraderGraph(make_trader_figure()))
a.set_client(client)
a.strategy_sell_and_hold()
a.backtest()
```
## Find the best strategy!
```python
import quick_trade as qtr
import ccxt
from quick_trade.tuner import *
from quick_trade import TradingClient
class Test(qtr.ExampleStrategies):
@strategy
def strategy_supertrend1(self, plot: bool = False, *st_args, **st_kwargs):
self.strategy_supertrend(plot=plot, *st_args, **st_kwargs)
self.convert_signal() # only long trades
return self.returns
@strategy
def macd(self, histogram=False, **kwargs):
if not histogram:
self.strategy_macd(**kwargs)
else:
self.strategy_macd_histogram_diff(**kwargs)
self.convert_signal()
return self.returns
@strategy
def psar(self, **kwargs):
self.strategy_parabolic_SAR(plot=False, **kwargs)
self.convert_signal()
return self.returns
params = {
'strategy_supertrend1':
[
{
'multiplier': Linspace(0.5, 22, 5)
}
],
'macd':
[
{
'slow': Linspace(10, 100, 3),
'fast': Linspace(3, 60, 3),
'histogram': Choise([False, True])
}
],
'psar':
[
{
'step': 0.01,
'max_step': 0.1
},
{
'step': 0.02,
'max_step': 0.2
}
]
}
tuner = QuickTradeTuner(
TradingClient(ccxt.binance()),
['BTC/USDT', 'OMG/USDT', 'XRP/USDT'],
['15m', '5m'],
[1000, 700, 800, 500],
params
)
tuner.tune(Test)
print(tuner.sort_tunes())
tuner.save_tunes('quick-trade-tunes.json') # save tunes as JSON
```
You can also set rules for arranging arguments for each strategy by using `_RULES_` and `kwargs` to access the values of the arguments:
```python
params = {
'strategy_3_sma':
[
dict(
plot=False,
slow=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
fast=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
mid=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
_RULES_='kwargs["slow"] > kwargs["mid"] > kwargs["fast"]'
)
],
}
```
## User's code example (backtest)
```python
from quick_trade import brokers
from quick_trade import trading_sys as qtr
from quick_trade.plots import *
import ccxt
from numpy import inf
client = brokers.TradingClient(ccxt.binance())
df = client.get_data_historical('BTC/USDT', '15m', 1000)
trader = qtr.ExampleStrategies('BTC/USDT', df=df, interval='15m')
trader.set_client(client)
trader.connect_graph(TraderGraph(make_trader_figure(height=731, width=1440, row_heights=[10, 5, 2])))
trader.strategy_2_sma(55, 21)
trader.backtest(deposit=1000, commission=0.075, bet=inf) # backtest on one pair
```
## Output plotly chart:

## Output print
```commandline
losses: 12
trades: 20
profits: 8
mean year percentage profit: 215.1878652911773%
winrate: 40.0%
mean deviation: 2.917382949881604%
Sharpe ratio: 0.02203412259055281
Sortino ratio: 0.02774402450236864
calmar ratio: 21.321078596349782
max drawdown: 10.092728860725552%
```
## Run strategy
Use the strategy on real moneys. YES, IT'S FULLY AUTOMATED!
```python
import datetime
from quick_trade.trading_sys import ExampleStrategies
from quick_trade.brokers import TradingClient
from quick_trade.plots import TraderGraph, make_figure
import ccxt
ticker = 'MATIC/USDT'
start_time = datetime.datetime(2021, # year
6, # month
24, # day
5, # hour
16, # minute
57) # second (Leave a few seconds to download data from the exchange)
class MyTrade(ExampleStrategies):
@strategy
def strategy(self):
self.strategy_supertrend(multiplier=2, length=1, plot=False)
self.convert_signal()
self.set_credit_leverages(1)
self.sl_tp_adder(10)
return self.returns
keys = {'apiKey': 'your api key',
'secret': 'your secret key'}
client = TradingClient(ccxt.binance(config=keys)) # or any other exchange
trader = MyTrade(ticker=ticker,
interval='1m',
df=client.get_data_historical(ticker, limit=10))
fig = make_trader_figure()
graph = TraderGraph(figure=fig)
trader.connect_graph(graph)
trader.set_client(client)
trader.realtime_trading(
strategy=trader.strategy,
start_time=start_time,
ticker=ticker,
limit=100,
wait_sl_tp_checking=5
)
```

## Additional Resources
Old documentation (V3 doc): https://vladkochetov007.github.io/quick_trade.github.io
# License

quick_trade by Vladyslav Kochetov is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Permissions beyond the scope of this license may be available at vladyslavdrrragonkoch@gmail.com.
%package help
Summary: Development documents and examples for quick-trade
Provides: python3-quick-trade-doc
%description help
# quick_trade
[](https://vshymanskyy.github.io/StandWithUkraine)
[](https://pepy.tech/project/quick-trade)
[)](https://pepy.tech/project/quick-trade)

```
Dependencies:
├──ta (Bukosabino https://github.com/bukosabino/ta (by Darío López Padial))
├──plotly (https://github.com/plotly/plotly.py)
├──pandas (https://github.com/pandas-dev/pandas)
├──numpy (https://github.com/numpy/numpy)
├──tqdm (https://github.com/tqdm/tqdm)
├──scikit-learn (https://github.com/scikit-learn/scikit-learn)
└──ccxt (https://github.com/ccxt/ccxt)
```
* **Documentation:** 🚧 https://quick-trade.github.io/quick_trade/#/ 🚧
* **Twitter:** [@quick_trade_tw](https://twitter.com/quick_trade_tw)
* **Discord**: [quick_trade](https://discord.gg/SkRg9mzuB5)
# Gitcoin Grant
The [Quadratic Funding](https://vitalik.ca/general/2019/12/07/quadratic.html) formula makes your one dollar grant much more socially valuable.
**[Support quick_trade through Gitcoin](https://gitcoin.co/grants/3876/quick_trade)**.
We will support community by opening bounties from your grants.
[](https://gitcoin.co/grants/3876/quick_trade)
## Installation:
Quick install:
```commandline
$ pip3 install quick-trade
```
For development:
```commandline
$ git clone https://github.com/quick-trade/quick_trade.git
$ pip3 install -r quick_trade/requirements.txt
$ cd quick_trade
$ python3 setup.py install
$ cd ..
```
## Customize your strategy!
```python
from quick_trade.plots import TraderGraph, make_trader_figure
import ccxt
from quick_trade import strategy, TradingClient, Trader
from quick_trade.utils import TradeSide
class MyTrader(qtr.Trader):
@strategy
def strategy_sell_and_hold(self):
ret = []
for i in self.df['Close'].values:
ret.append(TradeSide.SELL)
self.returns = ret
self.set_credit_leverages(2) # if you want to use a leverage
self.set_open_stop_and_take(stop)
# or... set a stop loss with only one line of code
return ret
client = TradingClient(ccxt.binance())
df = client.get_data_historical("BTC/USDT")
trader = MyTrader("BTC/USDT", df=df)
a.connect_graph(TraderGraph(make_trader_figure()))
a.set_client(client)
a.strategy_sell_and_hold()
a.backtest()
```
## Find the best strategy!
```python
import quick_trade as qtr
import ccxt
from quick_trade.tuner import *
from quick_trade import TradingClient
class Test(qtr.ExampleStrategies):
@strategy
def strategy_supertrend1(self, plot: bool = False, *st_args, **st_kwargs):
self.strategy_supertrend(plot=plot, *st_args, **st_kwargs)
self.convert_signal() # only long trades
return self.returns
@strategy
def macd(self, histogram=False, **kwargs):
if not histogram:
self.strategy_macd(**kwargs)
else:
self.strategy_macd_histogram_diff(**kwargs)
self.convert_signal()
return self.returns
@strategy
def psar(self, **kwargs):
self.strategy_parabolic_SAR(plot=False, **kwargs)
self.convert_signal()
return self.returns
params = {
'strategy_supertrend1':
[
{
'multiplier': Linspace(0.5, 22, 5)
}
],
'macd':
[
{
'slow': Linspace(10, 100, 3),
'fast': Linspace(3, 60, 3),
'histogram': Choise([False, True])
}
],
'psar':
[
{
'step': 0.01,
'max_step': 0.1
},
{
'step': 0.02,
'max_step': 0.2
}
]
}
tuner = QuickTradeTuner(
TradingClient(ccxt.binance()),
['BTC/USDT', 'OMG/USDT', 'XRP/USDT'],
['15m', '5m'],
[1000, 700, 800, 500],
params
)
tuner.tune(Test)
print(tuner.sort_tunes())
tuner.save_tunes('quick-trade-tunes.json') # save tunes as JSON
```
You can also set rules for arranging arguments for each strategy by using `_RULES_` and `kwargs` to access the values of the arguments:
```python
params = {
'strategy_3_sma':
[
dict(
plot=False,
slow=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
fast=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
mid=Choise([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]),
_RULES_='kwargs["slow"] > kwargs["mid"] > kwargs["fast"]'
)
],
}
```
## User's code example (backtest)
```python
from quick_trade import brokers
from quick_trade import trading_sys as qtr
from quick_trade.plots import *
import ccxt
from numpy import inf
client = brokers.TradingClient(ccxt.binance())
df = client.get_data_historical('BTC/USDT', '15m', 1000)
trader = qtr.ExampleStrategies('BTC/USDT', df=df, interval='15m')
trader.set_client(client)
trader.connect_graph(TraderGraph(make_trader_figure(height=731, width=1440, row_heights=[10, 5, 2])))
trader.strategy_2_sma(55, 21)
trader.backtest(deposit=1000, commission=0.075, bet=inf) # backtest on one pair
```
## Output plotly chart:

## Output print
```commandline
losses: 12
trades: 20
profits: 8
mean year percentage profit: 215.1878652911773%
winrate: 40.0%
mean deviation: 2.917382949881604%
Sharpe ratio: 0.02203412259055281
Sortino ratio: 0.02774402450236864
calmar ratio: 21.321078596349782
max drawdown: 10.092728860725552%
```
## Run strategy
Use the strategy on real moneys. YES, IT'S FULLY AUTOMATED!
```python
import datetime
from quick_trade.trading_sys import ExampleStrategies
from quick_trade.brokers import TradingClient
from quick_trade.plots import TraderGraph, make_figure
import ccxt
ticker = 'MATIC/USDT'
start_time = datetime.datetime(2021, # year
6, # month
24, # day
5, # hour
16, # minute
57) # second (Leave a few seconds to download data from the exchange)
class MyTrade(ExampleStrategies):
@strategy
def strategy(self):
self.strategy_supertrend(multiplier=2, length=1, plot=False)
self.convert_signal()
self.set_credit_leverages(1)
self.sl_tp_adder(10)
return self.returns
keys = {'apiKey': 'your api key',
'secret': 'your secret key'}
client = TradingClient(ccxt.binance(config=keys)) # or any other exchange
trader = MyTrade(ticker=ticker,
interval='1m',
df=client.get_data_historical(ticker, limit=10))
fig = make_trader_figure()
graph = TraderGraph(figure=fig)
trader.connect_graph(graph)
trader.set_client(client)
trader.realtime_trading(
strategy=trader.strategy,
start_time=start_time,
ticker=ticker,
limit=100,
wait_sl_tp_checking=5
)
```

## Additional Resources
Old documentation (V3 doc): https://vladkochetov007.github.io/quick_trade.github.io
# License

quick_trade by Vladyslav Kochetov is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Permissions beyond the scope of this license may be available at vladyslavdrrragonkoch@gmail.com.
%prep
%autosetup -n quick-trade-7.9.6
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-quick-trade -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Fri May 05 2023 Python_Bot - 7.9.6-1
- Package Spec generated