Skip to content

Commit

Permalink
replacing deepcopy with pickle which is faster
Browse files Browse the repository at this point in the history
  • Loading branch information
georgedanker committed Jun 10, 2024
1 parent 5efb85d commit 95ebc40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions betfairutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import enum
import heapq
import itertools
import pickle
import re
from bisect import bisect_left
from bisect import bisect_right
from collections import deque
from collections.abc import Mapping
from collections.abc import Sequence
from copy import deepcopy
from math import asin
from math import cos
from math import radians
Expand Down Expand Up @@ -3199,7 +3199,7 @@ def remove_bet_from_runner_book(
:return: A new runner book with the bet removed. The type of the return value will reflect the type of runner_book. If the given price is not available on the given side then the new runner book will be identical to runner_book
:raises: ValueError if size is greater than the size present in the order book
"""
runner_book = deepcopy(runner_book)
runner_book = pickle.loads(pickle.dumps(runner_book))
if isinstance(runner_book, dict):
ex = runner_book["ex"]
price_sizes = ex[available_side.ex_key]
Expand Down

0 comments on commit 95ebc40

Please sign in to comment.