Python code to place trades with (a Japan) exchange

I wanted to start a trading experience using automation in Python, just for fun and to see if I suck at trading or I gain something. Normally, trading in cryptocurrencies is a high risk activity, but I have decided I can throw a couple thousands EURO in this experiment. Who knows, maybe I am good and I will increase my wealth from trading crypto. If not, at least I gain experience (?!?) 😁 using Python and a couple of things from that exchange.


In assessing various exchanges, I came across several not regulated (I don’t know why people trade there, they are shaddy – may be they think high risk – high return, so this might be fair enough for me, but I don’t like playing in a no man’s land anyway).

I have made this choice (Liquid) as I saw the following good points:

  • Official license from the Japan Financial Services Agency as a Virtual Currency Exchange.
  • Global Leading Fintech Innovators in 2019 no.38 (rated by KPMG)
  • Ranked consistently among the top 10 regulated cryptocurrency exchanges globally based on daily traded spot volume with deep BTC/JPY liquidity.
  • At its core Liquid is an institutional-grade exchange that caters to the needs of blockchain projects and consumers alike with access to new markets and fiat (fiduciary currencies, a.k.a. USD, JPY, etc) gateways.
  • Applied for the Major Payment Institution licence under the Singapore Payment Services Act for the provision of digital payment token services.

The experience in opening an account with them was normal (I got verified, they have Know Your Customer procedure in place – one cannot start trading without to get his/her account verified).

A serious exchange with a satisfactory customer service (English language I used to communicate with them without any problem). Government ID, an utility bill and setting up your bank account details (needed for deposit and withdrawals in dollars i.e. USD) have been the activities requested to start trading.


I have installed Python (version 3.6.4) on both my laptop and VPS (a virtual private server). If one wonders why a VPS, there are a couple of arguments in its favor:

  1. availability of internet connection. When you buy a VPS service, the provider has a very good internet connection that is available 24/7 and it’s up 99,9% of time, including week-ends. Speed is needed to avoid delays in placing a trade. If market turns not in your favor, you might need to react quickly. Any interruption will cost you money. At home, you might interrupt the connection of scripts to internet when let’s say you forgot to plug in the laptop and battery is low (it happened to me quite often 🤷‍♂️)
  2. a server processes a Python Script more quickly than a laptop. So, I wanted to get data about prices in seconds and sometime on my laptop run many programms (Office with complex Excell sheets, Microsoft Access database, etc) and in addition if I watch a video from Youtube when learning some skills my laptop’s RAM gets overloaded and is running slow.

For installing Python one might want to check the steps I described in my previous post at this link (where you could find – if you are interested – also how to configure a VPS on Windows securely). I made that post when I wanted to ensure continuity of work in running some data collecting information from a couple of hundred websites using a script that take days (see also this link). Looking at that task when started, I noticed in Event Viewer of VPS some brute force attacks (unauthorised attempts to access my VPS from elsewhere), so I have secured that VPS and detailed at the mentioned link how I did it.

But it’s fine if you use the laptop just for a few number of tasks at the same time, the processing CPU is sufficient for trading if you don’t want to manage a database with complex algorhitms.

API (Application User Interface) at and how to use Python to access it

After one opens his account with Liquid exchange and is ready to trade, there is the possibility to create an API token.

API token comes with a secret key when created.

One can use these to trade at Liquid exchange not through its GUI (graphical user interface) i.e. a web browser, but using a script to connect to the REST API (for details regarding that API check this link).

Below there are some screen-shots for creation of an API token at exchange, as well as a screen shot from documentation (see the above-mentioned link).


  1. Strongly recommended is to keep that API token and Secret Key private. Anyone that has access to those two pieces of information can theoretically place trades and makes you bankrupt (unless you do it yourself … ha ha ha …)
  2. I have left unticked the withdrawal possibility using API. Unless you know what you are doing, strongly recommended is also to untick them.
  3. I left the IP restriction untouched. This is NOT recommended, but I have not decided yet where I want to trade from (tablet, VPS, laptop or phone). In case of tablet or phone usually the GSM provider cannot ensure the same IP when I use them. The IPs are changed upon criteria I cannot figure out. After I have a full automation (to code a script that will run from my laptop or 24/7 from my VPS), I will most likely add an IP and this means I cannot trade from other IPs except from that one that is added in Liquid settings.

At this link I have explained about the pip i.e. an utility that can aid at installing various Python libraries from github or from elsewhere (I like to integrate the work of others that aid in getting my job done more quickly – why to reinvent the wheel?).

So, I can simply install a new library from github with the following command at the Windows run -> cmd:

C:\WINDOWS\system32> pip install “opensource library”

and the relevant (open source) Python library gets installed on my laptop (Windows 10). Under the hood some files are automatically downloaded from github and installed in the relevant folders of my laptop. The process is transparent and quick.

For my purpose of trading at Liquid exchange I have installed ccxt (a library available for almost 100+ crypto exchanges), as follows:

C:\WINDOWS\system32>pip install ccxt

So far I have completed the below steps:

  • open an account with the relevant crypto exchange where my trading experience will start (
  • (previously I have installed Python version 3.6.4 on both a VPS and my laptop, as well as the pip utility – useful to add Python open source code generally available on github)
  • and I have installed ccxt (a Python wrapper of REST API, these APIs being available for the majority of crypto exchanges that want to get volumes from traders that have some tools to automate trading, like me).

In PART TWO of this article I am going to start using these tools to place orders on Liquid exchange using a Python script.

2 thoughts on “Python code to place trades with (a Japan) exchange

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: