Bgogo

Bgogo Trading API v1

URLs below are relative to our API server endpoint, so that /version is mapped to https://bgogo.com/api/version and so on.

We require both the IPv4 address and the user agent stay the same for a session token to be usable. Please make sure you set the correct user agent.

All APIs require the Accept header to be set as application/json.

At the end of this post, we provide a Bash script to help you get started.

================================================================================

GET /version

Response:
{
    status: 'ok',
    version: '1.0.0'
}

================================================================================

POST /send-security-code

Request:
{
    email: 'alice@example.com'
}

Errors:
    500 unable to send security code

================================================================================

POST /sign-in

Request:
{
    email: 'alice@example.com',
    password: '03f7495b51cc70b76872ed019d19dee1b73e89b6'
}


The password field is the SHA1 hash of the password clear text.

Response:
{
    status: 'ok',
    web_session_id: 123456,
    uid: 19260817,
    token: 'BEUefwxcbBdDQ39voteckb7amOOagOFM4MVe4ctDQeI='
}

In case of signing in from an unconfirmed device, it returns HTTP code 422 with
the following response:

    {
        status: 'error',
        otp_enabled: true,
        reason: 'unconfirmed device'
    }

NOTE: 'otp_enabled' is only present when Google 2FA is enabled

Errors:
    500 unable to get uid
    500 unable to sign in
    422 wrong password
    422 unconfirmed device

================================================================================

POST /confirm-current-device

Request:
{
    email: 'alice@example.com',
    security_code: '123456',
    otp: '123456',
    password: '03f7495b51cc70b76872ed019d19dee1b73e89b6'
}

NOTE: 'otp' is only required if Google 2FA is enabled.

Errors:
    500 unable to confirm current device
    422 wrong password

================================================================================

GET /balances

Headers:
    Authorization: Bearer BEUefwxcbBdDQ39voteckb7amOOagOFM4MVe4ctDQeI=

Response:
{
  status: 'ok',
  otp_enabled: true,
  balances: [
    { currency: 'ETH',
      available: '0.12345600', frozen: '0.00000000', step: '0.00000001',
      deposit_enabled: true, withdraw_enabled: false },
    { currency: 'BTC',
      available: '0.12345600', frozen: '0.00646616', step: '0.00000001',
      deposit_enabled: true, withdraw_enabled: false }
  ]
}

Errors:
    500 unable to get balances
    422 account not ready

================================================================================

GET /snapshot/ETH/BTC

Headers:
    Authorization: Bearer BEUefwxcbBdDQ39voteckb7amOOagOFM4MVe4ctDQeI=

*** NOTE: It has an unauthorized (public-only) version. See comments below. ***

Response:
{
  status: 'ok',
  all_symbols: [ 'ETH/BTC', 'YANG/MEOW' ],
  last_prices: [ '0.0527', '1.00010001' ],
  past_24hrs_price_changes: [ '23.12%', '-42.40%' ],
  price_step: '0.0001',
  amount_step: '0.0001',
  order_book: { bids: [{ price: '0.0528', amount: '0.1234' },
                       { price: '0.0527', amount: '0.1234' },
                       { price: '0.0526', amount: '0.1234' },
                       { price: '0.0525', amount: '0.1234' },
                       { price: '0.0524', amount: '0.1234' }],
                asks: [{ price: '0.0529', amount: '0.1234' },
                       { price: '0.0530', amount: '0.1234' },
                       { price: '0.0531', amount: '0.1234' },
                       { price: '0.0532', amount: '0.1234' },
                       { price: '0.0533', amount: '0.1234' }] },
  trade_history: [
    { price: '0.0528', amount: '0.1234', timestamp: 1507785073, side: 'buy' },
    { price: '0.0528', amount: '0.1234', timestamp: 1507785072, side: 'sell' }
  ],
  my_account_balances: [
    { currency: 'ETH',
      available: '0.12345600', frozen: '0.00000000', step: '0.00000001' },
    { currency: 'BTC',
      available: '0.12345600', frozen: '0.00646616', step: '0.00000001' }
  ],
  my_orders: [
    { id: '987654323', side: 'buy', price: '0.0524', amount: '0.1235',
      create_time: 1507785072, update_time: 1507785073, status: 'open',
      volume: '0.0001', turnover: '0.00000524' },
    { id: '987654322', side: 'sell', price: '0.0524', amount: '0.1235',
      create_time: 1507785072, update_time: 1507785073, status: 'cancelled',
      volume: '0.0001', turnover: '0.00000524' },
    { id: '987654321', side: 'buy', price: '0.0524', amount: '0.1235',
      create_time: 1507785072, update_time: 1507785073, status: 'closed',
      volume: '0.1235', turnover: '0.00647140' }
  ],
  my_fee_rate: '0.0025'
}

*******************************************************************************
*                                                                             *
*  If the Authorization header is missing, the API returns public-only data,  *
*  which excludes my_account_balances, my_orders, and my_fee_rate.            *
*                                                                             *
*  If the account is not ready, it also returns public-only data.             *
*                                                                             *
*******************************************************************************

Errors:
    500 unable to get snapshot
    422 invalid symbol

================================================================================

GET /candlesticks/ETH/BTC?zoom=24hr&candlestick=5m

Response:
{
  status: 'ok',
  candlesticks: [
    [1507766400, '927.7399', '949.9000', '927.7399', '944.4899', '223.940'],
    [1507852800, '941.3599', '950.6900', '940.5499', '949.5000', '102.030'],
    [1507939200, '952.0000', '959.7860', '951.5100', '959.1099', '158.100'],
    [1508025600, '959.9799', '962.5399', '947.8400', '953.2700', '128.340'],
    [1508112000, '980.0000', '987.5999', '972.2000', '972.5599', '204.214']
  ]
}

Valid zoom & candlestick combinations:

  -------------------------------------------
    Zoom    Candlestick
  -------------------------------------------
     6hr    5m  15m  30m  1hr  2hr
    24hr    5m  15m  30m  1hr  2hr  4hr
     1w         15m  30m  1hr  2hr  4hr  1d
     1m                   1hr  2hr  4hr  1d
  -------------------------------------------

Errors:
    422 invalid symbol
    422 invalid zoom
    422 invalid candlestick
    500 unable to get candlesticks

================================================================================

GET /tickers

Response:
{
  status: 'ok',
  tickers: {
    'ETH/BTC': {
        'last_price': '0.0527',
        'lowest_ask_price': '0.0400',
        'highest_bid_price': '0.0600',
        'past_24hrs_price_change': '23.12%',
        'past_24hrs_base_volume': 5.234,
        'past_24hrs_quote_turnover': 52.34,
        'past_24hrs_high_price': '0.0700',
        'past_24hrs_low_price': '0.0300'
    }
  }
}

Semantics of each field:

  - last_price: latest trade's strike price
  - lowest_ask_price: lowest ask price (the first entry of asks in order book)
  - highest_bid_price: highest bid price (the first entry of bids in order book)
  - past_24hrs_price_change: price change of last 24 hours in percentage
  - past_24hrs_base_volume: total traded volume in past 24 hours
  - past_24hrs_quote_turnover: total traded turnover in past 24 hours
  - past_24hrs_high_price: highest trade price in past 24 hours
  - past_24hrs_low_price: lowest trade price in past 24 hours

Errors:
    500 unable to get snapshot
    500 snapshot order_book missing
    500 snapshot all_symbols missing
    500 snapshot my_symbol missing

================================================================================

POST /place-order

Headers:
    Authorization: Bearer BEUefwxcbBdDQ39voteckb7amOOagOFM4MVe4ctDQeI=

Request:
{
    symbol: 'ETH/BTC',
    side: 'buy',
    price: '0.0529',
    amount: '0.1234'
}

Response:
{
    status: 'ok',
    order_id: '987654321'
}

Errors:
    422 invalid symbol
    422 invalid side
    500 unable to place order
    422 account not ready
    422 invalid price
    422 invalid amount
    422 balance not enough

================================================================================

POST /cancel-order/987654321

Headers:
    Authorization: Bearer BEUefwxcbBdDQ39voteckb7amOOagOFM4MVe4ctDQeI=

Errors:
    500 unable to cancel order
    422 account not ready
    422 order is closed
    422 invalid order id

================================================================================
  

Access your account

Please sign in to your account or create an account to start trading.

×