Skip to content

Commit

Permalink
update docstring; update release.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
btschwertfeger committed Jan 1, 2025
1 parent 9dc6518 commit a05a8ce
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 20 deletions.
8 changes: 5 additions & 3 deletions .github/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ changelog:
- title: Other Changes
labels:
- "*"
# exclude:
# labels:
# - dependencies
exclude:
labels:
- dependencies
- github_actions
- title: 👒 Dependencies
labels:
- dependencies
- github_actions
58 changes: 41 additions & 17 deletions kraken/spot/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,31 @@ def create_order( # pylint: disable=too-many-branches,too-many-arguments # noqa
3. When the price hits $27000 a limit order will be placed at
$26800 to sell 1.2 BTC. This ensures that the asset will be
sold for $26800 or better.
''' >>> from kraken.spot import Trade >>> trade =
Trade(key="api-key", secret="secret-key") >>> from datetime import
datetime, timedelta, timezone >>> deadline = ( ...
datetime.now(timezone.utc) + timedelta(seconds=20) ... ).isoformat()
>>> trade.create_order( ... ordertype="stop-loss-limit", ...
pair="XBTUSD", ... side="buy", ... volume=1.2, ...
price=24000, ... price2=25000, ... validate=True, # just
validate the input, do not place on the market ...
trigger="last", ... timeinforce="GTC", ... leverage=4, ...
deadline=deadline, ... close_ordertype="take-profit-limit", ...
close_price=27000, ... close_price2=26800, ... ) {
'''
>>> from kraken.spot import Trade
>>> trade = Trade(key="api-key", secret="secret-key")
>>> from datetime import datetime, timedelta, timezone
>>> deadline = (
... datetime.now(timezone.utc) + timedelta(seconds=20)
... ).isoformat()
>>> trade.create_order(
... ordertype="stop-loss-limit",
... pair="XBTUSD",
... side="buy",
... volume=1.2,
... price=24000,
... price2=25000,
... validate=True, # just validate the input, do not place on the market
... trigger="last",
... timeinforce="GTC",
... leverage=4,
... deadline=deadline,
... close_ordertype="take-profit-limit",
... close_price=27000,
... close_price2=26800,
... )
{
'descr': {
'order': 'buy 0.00100000 XBTUSD @ stop loss 24000.0 -> limit
25000.0 with 2:1 leverage', 'close': 'close position @ take
Expand All @@ -282,12 +296,22 @@ def create_order( # pylint: disable=too-many-branches,too-many-arguments # noqa
automatically
* The the percentage sign "%" can be used to define relative
changes.
''' >>> trade.create_order( ... ordertype="stop-loss-limit", ...
pair="XBTUSD", ... side="buy", ... volume=1.2, ...
price=24000, ... price2="+1000", ... validate=True, ...
trigger="last", ... timeinforce="GTC", ...
close_ordertype="take-profit-limit", ... close_price=27000, ...
close_price2="#2%", ... ) {
'''
>>> trade.create_order(
... ordertype="stop-loss-limit",
... pair="XBTUSD",
... side="buy",
... volume=1.2,
... price=24000,
... price2="+1000",
... validate=True,
... trigger="last",
... timeinforce="GTC",
... close_ordertype="take-profit-limit",
... close_price=27000,
... close_price2="#2%",
... )
{
'descr': {
'order': 'buy 0.00100000 XBTUSD @ stop loss 24000.0 -> limit
+1000.0', 'close': 'close position @ take profit 27000.0 ->
Expand Down

0 comments on commit a05a8ce

Please sign in to comment.