%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
# 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 # 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 # 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 * Tue Apr 25 2023 Python_Bot