CampBX API

­

Important: Please note that using API and Website interfaces concurrently may cause login interference issues. Please use different external IP addresses, or pause the bot when you need to use the Web UI.

Please do not abuse the API interface with brute-forcing bots and ensure that there is at least 500 millisecond latency between two calls (per IP address). We may revoke the API access without notice for accounts violating this requirement.

TOP

Prebuilt Tools & Libraries

If you are looking to get a jump-start on creating your bot for CampBX, please consider one of the following options:

Caution: Please note that all libraries listed in this subsection are developed and maintained by external contributors and not by CampBX. Use these libraries at your own risk and follow good security procedures prior to deployment.

­
PHP Client Library for CampBX API

The CampBX API PHP client library is implements all API calls doumented on this page. The author of this library is Brandon Beasley of SourceWerks LLC , and library is an open-source effort available under GPLv3 license.

The library, PHP example code, and documentation are available at BitBucket for CampBX API PHP Client Library. If you like the library, please consider making a donation towards Brandon's open-source efforts at Bitcoin address 1J9XU1C4yfcQhAbRHWxokv16HYLLQVMp5X

Python Bindings for CampBX API

Python bindings authored by Glen Zangirolami implement all information-related API calls documented on this page. Glen has shared his library under MIT license.

The library, Python example code, and documentation are available on Python.org website. If you use the library, don't forget to drop Glen a thank you note on his GitHub page

Node.js Library for CampBX API

A node.js library for accessing CampBX trading API functionality has been implemented by Preston Skupinski and is available under ISC license.

The library and documentation are available at GitHub respository of Preston Skupinski. If you use the library, please don't forget to send him a thank you note here!

SierraChart Technical Analysis Tool for CampBX

A free plugin from Slush allows you to take CampBX historic data and feed it into SierraChart Technical Analysis tool.

If you are not familiar with SierraChart, it is a desktop application that provides a professional Trading, Real-time and Historical Charting, and Technical Analysis platform for the financial markets. Despite a somewhat steep learning curve, it is very strong tool for professional technical analysis.

Steps to install and configure SierraChart for CampBX:

  • Download and install SierraChart software using default settings and data directory.
  • Download SierraChartfeed.exe for bitcoin markets.
  • Start the feed by typing "sierrachartfeed.exe -s cbxUSD" at the command prompt.
    (Help on all parameters can be obtained by typing "sierrachartfeed.exe --help" at the command prompt.)
  • Launch SierraChart software
  • Go to File Menu->New/Open Intraday Chart and select cbxUSD.scid
  • Customize your view using F5 (chart settings) and F6 (analysis/studies) menus.
  • That's it!

If you like the feed plugin, please consider making a donation at Slush's Bitcoin address 1FNTpsLm8Mitdd99YC1tHSyN2dVMdQiWYo

­
TOP

Testing Sandbox API

What is Testnet?

Testnet is nickname for a parallel Bitcoin network intended for testing all Bitcoin-related applications and websites. Testnet works exactly like Bitcoin, except that the testnet-Bitcoins are freely available and really easy to create. You can read more about Testnet here on Bitcoin Wiki.

CampBX's own Testnet version provides you a learning tool to train your bot, and practice your trading strategies with monopoly money instead of risking real money. We highly recommend debugging your bot on testnet before diving in to the livenet version.

How does Testnet Trading Work?

It works exactly the same way as real CampBX, except you get $10,000 monopoly money and 0.1 Testnet coins to start with. This should be enough to make at least 10 practice trades. Simply replace "https://campbx.com/api/" prefix with "https://testnet.campbx.com/api" to connect your bot to CampBX sandbox. Please note that TestNet uses a different login / pass combo for security.
If you have extra testnet coins, please donate them to our testnet address at:
­

 mo2C1kmE3s5pgvuU1Dxu5DKAN6J7NfSbze 

CampBX Testnet is our development team's sandbox to test new features, so it has higher downtime and error rate than production environment.
­
Try CampBX TestNet

­
TOP

General Information

Activating API Access

API access can be activated for an account by submitting a ticket to the Helpdesk here. Your ticket must include your email, username, and latest transaction date for security reasons.

Important: Please note that using API and Website interfaces concurrently may cause login interference issues. Please use different external IP addresses, or pause the bot when you need to use the Web UI.

Please do not abuse the API interface with brute-forcing bots, and ensure that there is at least 500 millisecond latency between two calls. We may revoke the API access without notice for accounts violating this requirement.

Data Format
  • Inputs: All input parameters for the API (with the exception of passwords) must be alpha-numeric. Repeated violations of this policy may result in an account ban.
  • Outputs: The output of the API is in JSON format. API calls that do not require authentication also support JSONP.
Making API Calls

Any API call that requires authentication must be made over SSL connection. Market data calls (which do not require authentication) can be also made over HTTP.

Please do not abuse the API interface with brute-forcing bots, and ensure that there is at least 500 millisecond latency between two calls. We may revoke the API access without notice for accounts violating this requirement.

A vast majority of API calls will be processed in under 10 seconds for normal market conditions. However, when multiple traders are attempting to cancel or modify their orders during volatile markets, the API call response times may slow down. Due to this reason, we recommend using a high timeout value of 4 minutes or more for your bot to prevent unexpected behavior during volatile markets.

API Throttling During High Server Load

When server load is very high, we throttle informational API calls and increase minimum API trade quantity to 0.1. We will provide a full throttling policy in this section shortly.

Standard Return Codes

There are three generic responses common across all API calls to simplify error handling.

­
  • Success:
    API call performed as expected. Some soft-errors that do not affect core-functionality, but may impact reporting/timeline can also return 'Success' code.
  • Info:
    Info is returned when an API call encounters empty result set or a soft-error. For example, if an API calls to obtain a list of open orders has zero results, an 'Info' code along with description "No open orders" will be the return value.
  • Error:
    When a fatal error occurs that does not allow the API call to proceed, an Error is returned as the result. In a vast majority of the cases, error can be traced back to improper API calls, brute-forcing the API, or malformed parameters.
­
TOP

Historic Data

Volume and Recent Trades

You can access CampBX Historic trade data and volume information through BitcoinCharts.com Market API.

Our symbol on BitcoinCharts.com website is CBXUSD .

If you like the BitcoinCharts.com service, please show your appreciation by sending them a donation at 1kqHKEYYC8CQPxyV53nCju4Lk2ufpQqA2 .

­
TOP

Accessing Market Data

Depth Table

This call returns the full CampBX market depth in JSON or JSONP format. The API call can be made at:

http://CampBX.com/api/xdepth.php For JSONP, you can specify a call back function name using "callback" parameter: http://CampBX.com/api/xdepth.php?callback=XYZ

Result is a JSON object or JSONP function with two arrays: Asks and Bids. Each element in these two arrays has two members: first member is Price and second member is Quantity available at that price. Both numbers are rounded to two decimal points.

Market Ticker

The API call to obtain market ticker in JSON or JSONP format can be made at:

http://CampBX.com/api/xticker.php For JSONP, you can specify a call back function name using "callback" parameter: http://CampBX.com/api/ticker.php?callback=XYZ

Result is a JSON object or JSONP function with three members: Last Trade Price, Best Bid Price, and Best Ask Price.

­
TOP

Accessing Account Data

Account Balances

An API call to obtain latest account balances can be made in following format:

https://CampBX.com/api/myfunds.php POST: user=USERNAME pass=PASSWORD

Result is a JSON object with six members.

  • First two members show Total USD and BTC balances for a given account, provided the login credentials are correct.
  • Next two members show Liquid USD and BTC balances not tied up in open orders on the order book.
  • Last two members show Margin Account USD and BTC balances. When you open or close a margin position, CampBX transparently moves funds in and out of the Margin Account; hence, no explicit funds-transfer is required.

Orders List

An API call to obtain list pending orders for an account can be made in following format:

https://CampBX.com/api/myorders.php POST: user=USERNAME pass=PASSWORD

Result is a JSON object with two arrays: Buy and Sell. Each array includes a sub-array of open Buy or Sell orders.

Possible order types: "Sell", "Quick Sell", "Short", "Buy", "Quick Buy", "Cover"

Possible price types: "Market", "Limit", "Stop + Limit"

Possible fill types: "Incr", "FOK", "AON"

Margin percent value can be between 1-100, or "None"

Possible dark pool values: "Yes" or "No"

Margin Positions List

An API call to obtain list open Margin positions for an account can be made in following format:

https://CampBX.com/api/mymargins.php POST user=USERNAME pass=PASSWORD

Result is a JSON object with an array of Margin positions including Margin Call Price, and current profit/loss on open positions.

­
TOP

Fund Transfers

Instant, Free Bitcoin Transfer

This feature has been disabled to comply with US State and Federal regulations.

Bitcoin Deposits

An API call to get Bitcoin deposit address for your account can be made in following format:


https://CampBX.com/api/getbtcaddr.php POST: user=USERNAME pass=PASSWORD

Please note that all parameters are case-sensitive.

An address generated through this method is disposable and comes with a preset expiry date. Do not use this address after the expiry date; our server stops monitoring the address after expiry date, and any subsequent deposits will not be credited to your account. If you mistakenly make a deposit to an expired address, our system administrator has to expend several hours to track it down. We have to bill these hours out to customer if they wish to recover a lost deposit.

API call returns two parameters: key "Success" with value as the Bitcoin Address if request is successful. Your will also receive key "Expiry" and number of seconds when the given address is scheduled to be wiped.
If the call fails or call is placed too close to a scheduled wallet wipe, it will generate an "Error" response.

Repeat API calls to this function will provide the same address till a deposit is received at the generated address. Once a deposit is received, subsequent API calls will provide a fresh address.

Bitcoin Send-to

An API call to send Bitcoins to an address can be made in following format:


https://CampBX.com/api/sendbtc.php POST: user=USERNAME pass=PASSWORD BTCTo=ADDRESS BTCAmt=DECIMAL

Please note that all parameters listed below are case-sensitive.

The BTCTo parameter must be a valid Bitcoin address, while BTCAmt must be a decimal value less than your account balance.

API call returns "Success" and the TX_ID if transfer is successful. The default withdrawal limit is 500 Bitcoins per 24 hours, and this limit can be raised by submitting a ticket to the helpdesk.

­
TOP

Executing Quick-Buy or Quick-Sell Orders

Canceling an Open Order

An API call to cancel an open order can be made in following format:

­
https://CampBX.com/api/tradecancel.php POST: user=USERNAME pass=PASSWORD Type=Buy OrderID=NUMERIC_ID
­
OR
­
https://CampBX.com/api/tradecancel.php POST: user=USERNAME pass=PASSWORD Type=Sell OrderID=NUMERIC_ID

Please note that all parameters for this call are case-sensitive.

The "Type" parameter refers to the order book you want to work with; permitted values are Buy or Sell.
"OrderID" must be a numeric value corresponding to the order that you are attempting to cancel. You can only cancel your own orders. Attempts to cancel random order IDs will result in a ban without notice.

Placing a New Order

An API call to placing an order can be made in following format:

­
https://CampBX.com/api/tradeenter.php POST: user=USERNAME pass=PASSWORD TradeMode=QuickBuy Quantity=DECIMAL Price=DECIMAL
­
OR
­
https://CampBX.com/api/tradeenter.php POST: user=USERNAME pass=PASSWORD TradeMode=QuickSell Quantity=DECIMAL Price=DECIMAL

Please note that all parameters listed below are case-sensitive.

The TradeMode parameter refers to the type of the order, and permitted values are QuickBuy or QuickSell.
Quick orders are described in more detail on the FAQ page; essentially they are limit-price orders that stay open on CampBX order book for up to 31 days.

Quantity and Price are decimal values that must follow all rules / limits set by CampBX. Minimum quantity to place an order is 0.1 Bitcoins.

Return Values:
If your entire order is executed immediately, the return value will be '0' in JSON format:
{"Success":"0"}
­
In case the order was not filled entirely, the return value would be corresponding Order ID in our Order Book.

­
TOP

Executing Advanced Orders

Advanced Orders

An API call to place an advanced order can be made in following format:

­
https://CampBX.com/api/tradeadv.php
­
POST Mandatory fields:
user=USERNAME pass=PASSWORD
TradeMode=AdvancedBuy OR TradeMode=AdvancedSell
Price=DECIMAL OR Price=Market
Quantity=DECIMAL

Optional Fields:
FillType=Incremental OR FillType=AON OR FillType=FOK
(If omitted, default Fill Type is Incremental)
­
DarkPool=No OR DarkPool=Yes
(Default is No Darkpool)
­
Expiry=YYYY/MM/DD
(Allowed range is 1 Hour through 31 Days) (Many additional formats are supported as well, including relative values! Please contact our helpdesk if you would like additional information about time/date formats.)
­

Please note that all parameters are case-sensitive. We highly recommend executing small trades and experimenting with all of the possible parameter values before implementing them in your strategy.

Expiry date field allows using many relative and absolute values and offers a lot of flexibility. If this is something that you rely on heavily in your strategy, please contact us for details about additional formats.

Return Values:
If your entire order is executed immediately, the return value will be '0' in JSON format:
{"Success":"0"}
­
In case the order was not filled entirely, the return value would be corresponding Order ID in our Order Book.

­
TOP

Short Selling and Margin Trading

Margin Buy

We are working on an API call to expose Margin trading functionality.

This API call will be activated when market liquidity crosses 1,000 Bitcoins per day for a sustained period. In the meantime, we encourage you to explore and understand this functionality on testnet prior to writing a bot around it.

Short Sell

We are working on an API call to expose Short Sell and Cover functionality.

This API call will be activated when market liquidity crosses 1,000 Bitcoins per day for a sustained period. In the meantime, we encourage you to explore and understand this functionality on testnet prior to writing a bot around it.

­
TOP

Other Questions

Enhancement Requests

If you have any enhancement requests for the API, please contact our helpdesk and share your idea! We are proactively looking for ideas that can make our core offering better suited to your requirements.

­
TOP
­
­