Tradeqwik API library available

in #tradeqwik7 years ago

tradeqwikapi.png

Not too long ago, whilst the VIVA ICO was still on, a bounty was made available for developers who could write code that made use of the functionality made available through the Tradeqwik API, see https://www.tradeqwik.com/

I thought I might give it a go, and decided to write my implementation in Go.
For the impatient, here is the repository on GitHub, https://github.com/shaunmza/tradeqwik

What will it do Jim?

Pretty much all of the trading functionality that is available via the normal Tradeqwik website is available via the API.

From a ticker, showing prices for currency pairs traded in the last 24 hours, recent trades and open trades for currency pairs, to trading functionality such as creating buy/sell orders, viewing your history etc.

The responses from the API are in a JSON format, which is widely used and simple to work with.

API Keys at the ready!

Though not entirely necessary, you may want to start with getting an API key set up. There are public end points that you can access

accountsettings.png

You do this by visiting your Account Settings, once logged in. Near the bottom of the page there is an area where you can add manage API keys.

You will need a key to authenticate your app/bot with, for any trading or account related calls and you can choose what permissions that specific keys will grant it's user to.

Lead by example...

Even though I was writing this library purely for my own personal use, I thought it pertinent to at least include some examples. That way future Shaun hates present Shaun a little less when he decides to play with this code again 😬

I am a bit on the lazy side, so lets reference the readme I added;

Examples are provided in the following directories;

  • examples/orders - Get open trades and recent trades
  • ticker/example - Periodically fetch ticker data
  • trading/example - Buy, sell or cancel orders, get your recent trade history, get your open trades - much of this is implemented in the marketmaker example too

examples/marketmaker - a bot that attempts to close orders within a 10% range of the target VIVA USD value of 5.5 (currently)

This depends on another library, run go get github.com/shaunmza/coinmarketcap to get it. You will also need to provide your API key, edit examples/marketmaker/bot.go and put your API key where you see this line;

trading.Init("YOUR API KEY")

I have since made changes to the code, fixing little irks along the way, so if you come across an example that's not working as expected, please give me a shout so I can fix it!

Another library?

Eagle eyed readers may have noticed the reference to another library, https://github.com/shaunmza/coinmarketcap

It was mentioned in the bounty that the Tradeqwik traders used https://coinmarketcap.com/ as a reference when setting prices, so seeing as my primary goal was to provide something that met the requirements of the bounty I decided to start at the lowest point, that being the integration into Coin market cap's api.

This library periodically fetches prices from coin market cap's api and puts it into a struct for you, making referencing the prices nice and simple later on.

This is held in a separate repository so that I can re-use it in other projects if the fancy takes me.

So? Watcha think? Huh, huh?

I am by no means an accomplished Go developer, so as such would love to get some feedback / criticism from people who dabble / work with Go.

We did two small projects at work using Go, which was enough to whet my appetite, but not enough to satiate me, for that reason alone I enjoyed putting this together.
Go is an amazing language that has the ability to frustrate me to no end sometimes, especially seeing as I am coming from PHP, where so much is done for you, under the hood.

Follow me!

Sort:  

Upvoting and resteeming with all viva accounts at 100% because this is important work for VIVA in general.

Much appreciated!

It was a great project to play around with Go again, I hope this helps someone looking to integrate with the api.

Thank you for improving our tools !

My pleasure, appreciate the comment and the upvote!

I wish I had listened to my parents and went to school for programming and development. Then I might have a real clue because it sounds very cool to me...but what do I know? :P

Well I believe it is never too late to start. It's simply not possible to write bad code when you are learning, if it works then it's awesome code.

Programming can be fun and very rewarding if you are that way inclined.

Thank you for sharing!

My pleasure, hope you find it useful!

You're welcome. I do.

Just stumbled upon this post and wanted to warn you about your TradeQwik Screenshot. The blurred mail address and API key is restorable with minimum effort. You should disable the key immediately! If you want to hide information in screenshots, paint it over completely with one solid colour ;)

Point taken, have deleted that key. Thanks for the heads up!

hello boss ,i will love to ask you some few questions ?

Sure ask away!

This API thing is getting my interest nowadays. Trying to grasp ideas by watching some videos and reading posts about it.

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 59947.96
ETH 2426.01
USDT 1.00
SBD 2.49