diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-12 05:14:10 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-12 05:14:10 +0000 |
commit | 0c6fb0321fdcea8a6aa40ac601cf6d6dd447c34a (patch) | |
tree | 85c83e74c180f96b15742f073d561b12e47832cd | |
parent | 21b93f37795dc508a36799edd5a32c2928f81776 (diff) |
automatic import of python-flumine
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-flumine.spec | 488 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 490 insertions, 0 deletions
@@ -0,0 +1 @@ +/flumine-2.3.5.tar.gz diff --git a/python-flumine.spec b/python-flumine.spec new file mode 100644 index 0000000..36726bc --- /dev/null +++ b/python-flumine.spec @@ -0,0 +1,488 @@ +%global _empty_manifest_terminate_build 0 +Name: python-flumine +Version: 2.3.5 +Release: 1 +Summary: Betting trading framework +License: MIT +URL: https://github.com/betcode-org/flumine +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ac/27/27865f60760854bf78d2773a9f403a31f11e60f49afe9107dd1c48f22023/flumine-2.3.5.tar.gz +BuildArch: noarch + +Requires: python3-betfairlightweight +Requires: python3-tenacity +Requires: python3-json-logger +Requires: python3-requests +Requires: python3-betconnect + +%description +<p align="center"> + <a href="https://github.com/betcode-org"> + <img src="docs/images/logo-full.png" title="betcode-org"> + </a> +</p> + +# flūmine + + [](https://coveralls.io/github/liampauling/flumine?branch=master) [](https://pypi.python.org/pypi/flumine) [](https://pepy.tech/project/flumine) + +Betting trading framework with a focus on: + +- simplicity +- modular +- pythonic +- rock-solid +- safe + + + +Support for market, order and custom streaming data. + +[docs](https://betcode-org.github.io/flumine/) + +[join betcode slack group](https://join.slack.com/t/betcode-org/shared_invite/zt-h0ato238-PPbfU_T7Ji0ORjz0ESIJkg) + +Tested on Python 3.7, 3.8, 3.9, 3.10 and 3.11. + +## installation + +``` +$ pip install flumine +``` + +flumine requires Python 3.7+ + +## setup + +Get started... + +```python +import betfairlightweight +from flumine import Flumine, clients + +trading = betfairlightweight.APIClient("username") +client = clients.BetfairClient(trading) + +framework = Flumine( + client=client, +) +``` + +Example strategy: + +```python +from flumine import BaseStrategy +from flumine.order.trade import Trade +from flumine.order.order import LimitOrder, OrderStatus +from flumine.markets.market import Market +from betfairlightweight.filters import streaming_market_filter +from betfairlightweight.resources import MarketBook + + +class ExampleStrategy(BaseStrategy): + def start(self) -> None: + print("starting strategy 'ExampleStrategy'") + + def check_market_book(self, market: Market, market_book: MarketBook) -> bool: + # process_market_book only executed if this returns True + if market_book.status != "CLOSED": + return True + + def process_market_book(self, market: Market, market_book: MarketBook) -> None: + # process marketBook object + for runner in market_book.runners: + if runner.status == "ACTIVE" and runner.last_price_traded < 1.5: + trade = Trade( + market_id=market_book.market_id, + selection_id=runner.selection_id, + handicap=runner.handicap, + strategy=self + ) + order = trade.create_order( + side="LAY", + order_type=LimitOrder(price=1.01, size=2.00) + ) + market.place_order(order) + + def process_orders(self, market: Market, orders: list) -> None: + for order in orders: + if order.status == OrderStatus.EXECUTABLE: + if order.size_remaining == 2.00: + market.cancel_order(order, 0.02) # reduce size to 1.98 + if order.order_type.persistence_type == "LAPSE": + market.update_order(order, "PERSIST") + if order.size_remaining > 0: + market.replace_order(order, 1.02) # move + + +strategy = ExampleStrategy( + market_filter=streaming_market_filter( + event_type_ids=["7"], + country_codes=["GB"], + market_types=["WIN"], + ) +) + +framework.add_strategy(strategy) +``` + +Run framework: + +```python +framework.run() +``` + +## Features + +- Streaming +- Multiple strategies +- Multiple clients +- Order execution +- Paper trading +- Simulation +- Event simulation (multi market) +- Middleware and background workers to enable Scores / RaceCard / InPlayService + +## Dependencies + +flumine relies on these libraries: + +* `betfairlightweight` - Betfair API support +* `tenacity` - Used for connection retrying (streaming) +* `python-json-logger` - JSON logging +* `requests` - HTTP support + + + + +%package -n python3-flumine +Summary: Betting trading framework +Provides: python-flumine +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-flumine +<p align="center"> + <a href="https://github.com/betcode-org"> + <img src="docs/images/logo-full.png" title="betcode-org"> + </a> +</p> + +# flūmine + + [](https://coveralls.io/github/liampauling/flumine?branch=master) [](https://pypi.python.org/pypi/flumine) [](https://pepy.tech/project/flumine) + +Betting trading framework with a focus on: + +- simplicity +- modular +- pythonic +- rock-solid +- safe + + + +Support for market, order and custom streaming data. + +[docs](https://betcode-org.github.io/flumine/) + +[join betcode slack group](https://join.slack.com/t/betcode-org/shared_invite/zt-h0ato238-PPbfU_T7Ji0ORjz0ESIJkg) + +Tested on Python 3.7, 3.8, 3.9, 3.10 and 3.11. + +## installation + +``` +$ pip install flumine +``` + +flumine requires Python 3.7+ + +## setup + +Get started... + +```python +import betfairlightweight +from flumine import Flumine, clients + +trading = betfairlightweight.APIClient("username") +client = clients.BetfairClient(trading) + +framework = Flumine( + client=client, +) +``` + +Example strategy: + +```python +from flumine import BaseStrategy +from flumine.order.trade import Trade +from flumine.order.order import LimitOrder, OrderStatus +from flumine.markets.market import Market +from betfairlightweight.filters import streaming_market_filter +from betfairlightweight.resources import MarketBook + + +class ExampleStrategy(BaseStrategy): + def start(self) -> None: + print("starting strategy 'ExampleStrategy'") + + def check_market_book(self, market: Market, market_book: MarketBook) -> bool: + # process_market_book only executed if this returns True + if market_book.status != "CLOSED": + return True + + def process_market_book(self, market: Market, market_book: MarketBook) -> None: + # process marketBook object + for runner in market_book.runners: + if runner.status == "ACTIVE" and runner.last_price_traded < 1.5: + trade = Trade( + market_id=market_book.market_id, + selection_id=runner.selection_id, + handicap=runner.handicap, + strategy=self + ) + order = trade.create_order( + side="LAY", + order_type=LimitOrder(price=1.01, size=2.00) + ) + market.place_order(order) + + def process_orders(self, market: Market, orders: list) -> None: + for order in orders: + if order.status == OrderStatus.EXECUTABLE: + if order.size_remaining == 2.00: + market.cancel_order(order, 0.02) # reduce size to 1.98 + if order.order_type.persistence_type == "LAPSE": + market.update_order(order, "PERSIST") + if order.size_remaining > 0: + market.replace_order(order, 1.02) # move + + +strategy = ExampleStrategy( + market_filter=streaming_market_filter( + event_type_ids=["7"], + country_codes=["GB"], + market_types=["WIN"], + ) +) + +framework.add_strategy(strategy) +``` + +Run framework: + +```python +framework.run() +``` + +## Features + +- Streaming +- Multiple strategies +- Multiple clients +- Order execution +- Paper trading +- Simulation +- Event simulation (multi market) +- Middleware and background workers to enable Scores / RaceCard / InPlayService + +## Dependencies + +flumine relies on these libraries: + +* `betfairlightweight` - Betfair API support +* `tenacity` - Used for connection retrying (streaming) +* `python-json-logger` - JSON logging +* `requests` - HTTP support + + + + +%package help +Summary: Development documents and examples for flumine +Provides: python3-flumine-doc +%description help +<p align="center"> + <a href="https://github.com/betcode-org"> + <img src="docs/images/logo-full.png" title="betcode-org"> + </a> +</p> + +# flūmine + + [](https://coveralls.io/github/liampauling/flumine?branch=master) [](https://pypi.python.org/pypi/flumine) [](https://pepy.tech/project/flumine) + +Betting trading framework with a focus on: + +- simplicity +- modular +- pythonic +- rock-solid +- safe + + + +Support for market, order and custom streaming data. + +[docs](https://betcode-org.github.io/flumine/) + +[join betcode slack group](https://join.slack.com/t/betcode-org/shared_invite/zt-h0ato238-PPbfU_T7Ji0ORjz0ESIJkg) + +Tested on Python 3.7, 3.8, 3.9, 3.10 and 3.11. + +## installation + +``` +$ pip install flumine +``` + +flumine requires Python 3.7+ + +## setup + +Get started... + +```python +import betfairlightweight +from flumine import Flumine, clients + +trading = betfairlightweight.APIClient("username") +client = clients.BetfairClient(trading) + +framework = Flumine( + client=client, +) +``` + +Example strategy: + +```python +from flumine import BaseStrategy +from flumine.order.trade import Trade +from flumine.order.order import LimitOrder, OrderStatus +from flumine.markets.market import Market +from betfairlightweight.filters import streaming_market_filter +from betfairlightweight.resources import MarketBook + + +class ExampleStrategy(BaseStrategy): + def start(self) -> None: + print("starting strategy 'ExampleStrategy'") + + def check_market_book(self, market: Market, market_book: MarketBook) -> bool: + # process_market_book only executed if this returns True + if market_book.status != "CLOSED": + return True + + def process_market_book(self, market: Market, market_book: MarketBook) -> None: + # process marketBook object + for runner in market_book.runners: + if runner.status == "ACTIVE" and runner.last_price_traded < 1.5: + trade = Trade( + market_id=market_book.market_id, + selection_id=runner.selection_id, + handicap=runner.handicap, + strategy=self + ) + order = trade.create_order( + side="LAY", + order_type=LimitOrder(price=1.01, size=2.00) + ) + market.place_order(order) + + def process_orders(self, market: Market, orders: list) -> None: + for order in orders: + if order.status == OrderStatus.EXECUTABLE: + if order.size_remaining == 2.00: + market.cancel_order(order, 0.02) # reduce size to 1.98 + if order.order_type.persistence_type == "LAPSE": + market.update_order(order, "PERSIST") + if order.size_remaining > 0: + market.replace_order(order, 1.02) # move + + +strategy = ExampleStrategy( + market_filter=streaming_market_filter( + event_type_ids=["7"], + country_codes=["GB"], + market_types=["WIN"], + ) +) + +framework.add_strategy(strategy) +``` + +Run framework: + +```python +framework.run() +``` + +## Features + +- Streaming +- Multiple strategies +- Multiple clients +- Order execution +- Paper trading +- Simulation +- Event simulation (multi market) +- Middleware and background workers to enable Scores / RaceCard / InPlayService + +## Dependencies + +flumine relies on these libraries: + +* `betfairlightweight` - Betfair API support +* `tenacity` - Used for connection retrying (streaming) +* `python-json-logger` - JSON logging +* `requests` - HTTP support + + + + +%prep +%autosetup -n flumine-2.3.5 + +%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-flumine -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 2.3.5-1 +- Package Spec generated @@ -0,0 +1 @@ +f000a683220248d6d4e2dd905c0fcbca flumine-2.3.5.tar.gz |