It seems that cancelall childorders can be used to cancel all parent orders (special orders) with the bitflyer API

Although the name is cancelallchildorders, parent orders (special orders) are also canceled.

Here in the documentation https://lightning.bitflyer.com/docs#%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E6%B3%A8%E6%96%87%E3%82%92%E3%82%AD%E3%83%A3%E3%83%B3%E3%82%BB%E3%83%AB%E3%81%99%E3%82%8B

With pybitflyer

    def cancelallchildorders(self, **params):
        """Cancel All Orders

        API Type
        --------
        HTTP Private API

        Parameters
        ----------
        product_code: The product for the corresponding order. Designate "BTC_JPY", "FX_BTC_JPY" or "ETH_BTC".

        Response
        --------
        If the parameters are correct, the status code will show 200 OK.

        Docs
        ----
        https://lightning.bitflyer.jp/docs?lang=en#cancel-all-orders
        """
        if not all([self.api_key, self.api_secret]):
            raise AuthException()

        endpoint = "/v1/me/cancelallchildorders"
        return self.request(endpoint, "POST", params=params)

※Notes

The following is the result when executed in our environment on 2020/01/18. There is a good chance that it will behave differently if it is executed in a different environment or due to a specification change on the API side. When creating a BOT, etc. using the following results, please make it after thorough verification.

Sample (with parent order)

cancel = bfapi.cancelallchildorders(product_code=SYMBOL)
print(cancel)

→ Nothing is displayed.

bfapi.getparentorders(product_code=SYMBOL)

Execution result


[{'id': 263032602,
  'parent_order_id': 'JCP20200118-065956-905830',
  'product_code': 'FX_BTC_JPY',
  'side': 'BUYSELL',
  'parent_order_type': 'IFDOCO',
  'price': 1006594.0,
  'average_price': 0.0,
  'size': 0.03,
  'parent_order_state': 'CANCELED',
  'expire_date': '2020-01-18T08:39:56.61',
  'parent_order_date': '2020-01-18T06:59:56.61',
  'parent_order_acceptance_id': 'JRF20200118-065956-127674',
  'outstanding_size': 0.0,
  'cancel_size': 0.03,
  'executed_size': 0.0,
  'total_commission': 0.0},
.
.
.

Make sure parent_order_state is'CANCELED'

Impressions

I am executing an IFDOCO order with a for statement. I thought that it should be initialized by canceling all positions and canceling all orders at the beginning of the for loop, and I came up with this result. I hope it will be useful for those who want to achieve the same thing.

Recommended Posts

It seems that cancelall childorders can be used to cancel all parent orders (special orders) with the bitflyer API
I tried to expand the database so that it can be used with PES analysis software
It seems that Skeleton Tracking can be done with RealSense
Tensorflow, it seems that even the eigenvalues of the matrix can be automatically differentiated
I tried to summarize the operations that are likely to be used with numpy-stl
File types that can be used with Go
[Python] Introduction to web scraping | Summary of methods that can be used with webdriver
Python knowledge notes that can be used with AtCoder
A script that makes it easy to create rich menus with the LINE Messaging API
How to set variables that can be used throughout the Django app-useful for templates, etc.-
Goroutine (parallel control) that can be used in the field
Goroutine that can be used in the field (errgroup.Group edition)
I investigated the pretreatment that can be done with PyCaret
[For IT beginners] What to do when the rev command cannot be used with Git Bash
Understand the probabilities and statistics that can be used for progress management with a python program
About the matter that torch summary can be really used when building a model with Pytorch
It seems that you can now write gate books with blueqat
A timer (ticker) that can be used in the field (can be used anywhere)
Comparison of 4 styles that can be passed to seaborn with set_context
Python standard module that can be used on the command line
Can the Kalman filter be used to predict stock price trends?
It seems that some RHEL will be free with a big boo for the end of CentOS
If you try to start the jupyter notebook installed with pip and it says "command not found", it seems that you can go through the PATH.