NAV

python javascript

Introduction

Welcome to the GCX.io API! You can use our API to access GCX.io API endpoints.

Using the GCX.io API you can empower your own applications to use Gold payments. Developing a game? Want your users to be compensated in real 999.9 Gold? Integrate with the GCX API!

We have language bindings in Python and streaming JavaScript using the Pusher library. You can view code examples in the dark area to the right.

Our GitHub page is available here: GCX Gold GitHub where you can download the latest libraries to interact with the API

If you have any questions our development team are always at hand to help info@gcx.io

User management

Signup user

from gcx import gcx

gcx = gcx()

gcx.signup("email","username","password")

The above command returns JSON structured like this:

[
  {
    "result": "success",
    "email_verification": "abc123456"
  }
]

This endpoint creates a new user.

HTTP Request

POST https://api.gcx.io/signup

POST Parameters

Parameter Description
email Email of user
username Username of user
password Password of user

Please note

The email_verification id returned in the JSON response has to be passed to /verify in order for a trader_id do be generated.

Verify a user

from gcx import gcx

gcx = gcx()

gcx.verify("email_verification")

The above command returns JSON structured like this:

[
  {
    "result": "success",
    "username": "username",
    "trader_id": "trader_id"
  }
]

This endpoint verifies a user that’s been created and is pending email verification.

HTTP Request

POST https://api.gcx.io/verifyemail

POST Parameters

Parameter Description
email_verification The email_verification code received from the signup step

Login a user

from gcx import gcx

gcx = gcx()

gcx.login("username","password")

The above command returns JSON structured like this:


[
  {
    "result": "success",
    "username": "username",
    "email": "email",
    "trader_id": "trader_id"
  }
]

This endpoint logs in a user and retrieves their trader_id

HTTP Request

POST https://api.gcx.io/login

POST Parameters

Parameter Description
username Users username
password Users password

Market data

Get bids

var pusher = new Pusher('b268591d0028e773de47');
var marketdata = pusher.subscribe('marketdata');
marketdata.bind('get_bids', function(data) { 
       console.log(data)
});
from gcx import gcx

gcx = gcx()

gcx.getbids()

The above command returns JSON structured like this:


[{
    "price": 25.2,
    "shares": 1.281
}, {
    "price": 25.0,
    "shares": 15.0
}, {
    "price": 24.9,
    "shares": 5.0
}]

This endpoint retrieves the top 10 bid prices on the GCX exchange ordered by price in descending order.

HTTP Request

GET https://api.gcx.io/orders/getbids

Get asks


var pusher = new Pusher('b268591d0028e773de47');
var marketdata = pusher.subscribe('marketdata');
marketdata.bind('get_asks', function(data) { 
       console.log(data)
});
from gcx import gcx

gcx = gcx()

gcx.getasks()

The above command returns JSON structured like this:

[{
  "price": 27.5,
  "shares": 1.12
}, {
  "price": 27.6,
  "shares": 5.0
}, {
  "price": 27.9,
  "shares": 500.0
}]

This endpoint retrieves the top 10 ask prices on the GCX exchange ordered by price in ascending order.

HTTP Request

GET https://api.gcx.io/orders/getasks

Wallet management

Fund with Bitcoin/Litecoin

from gcx import gcx
gcx = gcx()
gcx.fundbtc("trader_id","currency","amount")

The above command returns JSON structured like this:

[{
  "btcrate": "287.7432",
  "url": "https://gateway.gocoin.com/invoices/6bdb56da-a3c1-452b-99e7-76d5f50da8a5",
  "btcamount": "amount",
  "result": "success",
  "paymentaddress": "1MLYmN7bCpr3ZvQAfvXz8Qs6PLWDuAP1oM",
  "bitcoinurl": "bitcoin:1MLYmN7bCpr3ZvQAfvXz8Qs6PLWDuAP1oM"
}]

This endpoint instructs GCX to generate a Bitcoin deposit address through our partner GoCoin in order to fund your account with Bitcoin or Litecoin

HTTP Request

POST https://api.gcx.io/preparebtcinvoice

POST Parameters

Parameter Description
trader_id trader_id of user
amount amount in “BTC” in “GBP” or in “LTC”
currency “BTC”, “GBP” or “LTC”

Withdraw funds

from gcx import gcx

gcx = gcx()

gcx.withdrawfiat("trader_id","amount")

The above command returns JSON structured like this:

[{
  "result": "success",
  "data": "your email"

}]

If withdrawal request fails then the following responses may be received depending on the reason

[{
  "result": "failure",
  "data": "banknotset"

}]
[{
  "result": "failure",
  "data": "balancelow"

}]

This endpoint instructs GCX to send funds to your registered bank account.

HTTP Request

POST https://api.gcx.io/withdrawfiat

POST Parameters

Parameter Description
trader_id trader_id of user
amount amount to withdraw e.g, 20 for £20

Get user balance

from gcx import gcx

gcx = gcx()

gcx.getbalance("trader_id")
   var pusher = new Pusher('b268591d0028e773de47');
   var trader_id = "abc123"
   var balancechannel = pusher.subscribe('balance_update_' + trader_id);
   balancechannel.bind('accountbalance',function(data) { 
    console.log(data)
  });

The above command returns JSON structured like this:

        [{
            "result": "success",
            "available_fiat":"10.29",
            "outstanding_commitment":"1117.84",
            "available_gold":"0E-8",
            "escrow_gold":"1103.38170000"
        }]

This endpoint retrieves the users balance in fiat and in Gold

HTTP Request

POST https://api.gcx.io/get_balancex

POST Parameters

Parameter Description
trader_id trader_id of user

Order management

Get orders

from gcx import gcx

gcx = gcx()

gcx.getorders("trader_id")
var pusher = new Pusher('b268591d0028e773de47');
var trader_id = 'abc123'
var orders_channel = pusher.subscribe('orders_channel_' + trader_id);
orders_channel.bind('get_orders',function(data) {
      console.log(data)
});

The above command returns JSON structured like this:

[{
  "oid": "4ba4d0923g",
  "priority": 1455194392869376.0,
  "bidask": "ask",
  "price": 28.0,
  "shares": 550.64,
  "shares_initial": 550.64,
  "otype": "LO"
}, {
  "oid": "d5v4270ba6",
  "priority": 1455194375608812.0,
  "bidask": "ask",
  "price": 27.9,
  "shares": 500.0,
  "shares_initial": 500.0,
  "otype": "LO"
}]

This endpoint retrieves the current live orders submitted by the user (limit orders resting on the order book)

HTTP Request

POST https://api.gcx.io/orders

POST Parameters

Parameter Description
trader_id trader_id of user

JSON response parameters

Parameter Description
oid order id
priority unix time * 10^6
bidask direction of order either ‘bid’ or 'ask’
price price
shares quantity of commodity
shares_initial how much quantity was initially offerred or bid at this level (if shares is equal to shares_initial then nothing has matched against this order)
otype order type either “LO” or “MKT” Limit order or Market order

Cancel order

from gcx import gcx

gcx = gcx()

gcx.cancelorder("trader_id","oid")

The above command returns JSON structured like this:

[{
"result": "success"
}]

This endpoint cancels a current live order

HTTP Request

POST https://api.gcx.io/order/cancel

POST Parameters

Parameter Description
trader_id trader_id of user
oid order_id of order you wish to cancel (obtained from /orders)

Place order

from gcx import gcx

gcx = gcx()

gcx.trade("trader_id","shares","price","bidask","order")

The above command returns JSON structured like this:

[{
"result": "success"
}]

If your balance is too low the response received is:

[{
"result": "balancelow"
}]

This endpoint submits an order (either buy (bid) or sell (ask)) to the GCX order book for matching.

HTTP Request

POST https://api.gcx.io/trade

POST Parameters

Parameter Description
trader_id trader_id of user
shares amount of gold being bought or sold
price price to buy at or sell at
bidask either “bid” or “ask”
order either “LO” for limit order or “MKT” for Market order

e.g, if you would like to simply buy 5g of Gold you would issue:

gcx.trade(trader_id,"5","0","bid","MKT")

This would create a market buy order for 5g of Gold

Send Gold

Email Gold

from gcx import gcx

gcx = gcx()

gcx.emailgold("trader_id","recipient email","amount")

If successful, the above command returns JSON structured like this:

[{
  "result": "success",
  "data": "0"
}]

If your balance is low the above command returns JSON structured like this:

[{
  "result": "failure",
  "reason": "balancelow"
}]

This endpoint transfers gold grams from your account to another users email. The user you send gold to does not need to already be a GCX user. To redeem their Gold, they will need to create an account however.

HTTP Request

POST https://gcx.io/emailgold.php

POST Parameters

Parameter Description
trader_id trader_id of user
recipient email of recipient
amount amount of gold to send in grams

SMS Gold

from gcx import gcx

gcx = gcx()

gcx.smsgold("trader_id","recipient mobile","amount")

If successful, the above command returns JSON structured like this:

[{
  "result": "success",
  "data": "0"
}]

If your balance is low the above command returns JSON structured like this:

[{
  "result": "failure",
  "reason": "balancelow"
}]

This endpoint sends Gold to any mobile worldwide by SMS. To redeem Gold, the user will have to create an account on GCX and verify their mobile number.

HTTP Request

POST https://gcx.io/smsgold.php

POST Parameters

Parameter Description
trader_id trader_id of user
mobile recipients mobile number including country code (e.g, for the UK +447841334026 would be: 447841334022)
amount amount of gold grams to send