Skip to content
Snippets Groups Projects
Commit 5e6f5849 authored by Fabian Schuh's avatar Fabian Schuh
Browse files

[expiration] allow order expiration to be defined from storage

parent e29f27c5
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ clean-build: ...@@ -10,7 +10,7 @@ clean-build:
rm -fr build/ rm -fr build/
rm -fr dist/ rm -fr dist/
rm -fr *.egg-info rm -fr *.egg-info
rm -fr __pycache__/ .eggs/ .cache/ rm -fr __pycache__/ .eggs/ .cache/ .tox/
clean-pyc: clean-pyc:
find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyc' -exec rm -f {} +
......
...@@ -356,7 +356,7 @@ class Market(dict): ...@@ -356,7 +356,7 @@ class Market(dict):
self, self,
price, price,
amount, amount,
expiration=7 * 24 * 60 * 60, expiration=None,
killfill=False, killfill=False,
account=None, account=None,
returnOrderId=False returnOrderId=False
...@@ -395,6 +395,8 @@ class Market(dict): ...@@ -395,6 +395,8 @@ class Market(dict):
* This means that you actually place a sell order for 1000 BTS in order to obtain **at least** 10 USD * This means that you actually place a sell order for 1000 BTS in order to obtain **at least** 10 USD
* If an order on the market exists that sells USD for cheaper, you will end up with more than 10 USD * If an order on the market exists that sells USD for cheaper, you will end up with more than 10 USD
""" """
if not expiration:
expiration = self.bitshares.config["order-expiration"]
if not account: if not account:
if "default_account" in self.bitshares.config: if "default_account" in self.bitshares.config:
account = self.bitshares.config["default_account"] account = self.bitshares.config["default_account"]
...@@ -453,7 +455,7 @@ class Market(dict): ...@@ -453,7 +455,7 @@ class Market(dict):
self, self,
price, price,
amount, amount,
expiration=7 * 24 * 60 * 60, expiration=None,
killfill=False, killfill=False,
account=None, account=None,
returnOrderId=False returnOrderId=False
...@@ -480,6 +482,8 @@ class Market(dict): ...@@ -480,6 +482,8 @@ class Market(dict):
market. I.e. in the BTC/BTS market, prices are BTS per BTC. market. I.e. in the BTC/BTS market, prices are BTS per BTC.
That way you can multiply prices with `1.05` to get a +5%. That way you can multiply prices with `1.05` to get a +5%.
""" """
if not expiration:
expiration = self.bitshares.config["order-expiration"]
if not account: if not account:
if "default_account" in self.bitshares.config: if "default_account" in self.bitshares.config:
account = self.bitshares.config["default_account"] account = self.bitshares.config["default_account"]
...@@ -531,7 +535,6 @@ class Market(dict): ...@@ -531,7 +535,6 @@ class Market(dict):
tx["orderid"] = tx["operation_results"][0][1] tx["orderid"] = tx["operation_results"][0][1]
self.bitshares.blocking = prevblocking self.bitshares.blocking = prevblocking
def cancel(self, orderNumber, account=None): def cancel(self, orderNumber, account=None):
""" Cancels an order you have placed in a given market. Requires """ Cancels an order you have placed in a given market. Requires
only the "orderNumber". An order number takes the form only the "orderNumber". An order number takes the form
......
...@@ -221,6 +221,7 @@ class Configuration(DataDir): ...@@ -221,6 +221,7 @@ class Configuration(DataDir):
"node": "wss://node.bitshares.eu", "node": "wss://node.bitshares.eu",
"rpcpassword": "", "rpcpassword": "",
"rpcuser": "", "rpcuser": "",
"order-expiration": 7 * 24 * 60 * 60,
} }
def __init__(self): def __init__(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment