Bitfinex C++ API client
Switch branches/tags
Nothing to show
Clone or download
MMquant Develop merge (#11)
* Removing not needed files.

* Moving project source into app folder.

* Adding docker files for alpine distro.

* Updating README.md.

* Updating git ignore.

* Code improvement (#9)

* Removing not needed files.

* Moving project source into app folder.

* Adding docker files for alpine distro.

* Adding test.

* Moving all the curl calls and settings to the Request object.

* Formatting header.

* Making key-secret file optional.

* circleci fix
Latest commit dc03fed Nov 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Develop merge (#11) Nov 9, 2018
app Develop merge (#11) Nov 9, 2018
docker Develop merge (#11) Nov 9, 2018
.gitignore Develop merge (#11) Nov 9, 2018
Dockerfile Develop merge (#11) Nov 9, 2018
README.md Develop merge (#11) Nov 9, 2018
docker-compose.yml Develop merge (#11) Nov 9, 2018
license.txt Create license.txt Jan 30, 2017

README.md

bfx-cpp-api logo


Build status

Linux
lin-badge

Notice

Master branch contains new version of the client. For old version checkout legacy branch.

Synopsis

This header-only library contains class for interfacing Bitfinex REST API v1. Current version supports response JSON schema validation.

Dependencies

bfx-cpp-api depends on following external libraries/packages

How to Build'n'Run src/example.cpp

  1. Install dependencies (via apt, homebrew etc.).
  2. Clone or download bfx-api-cpp repository.
  3. Add key-secret file in bfx-api-cpp/app/doc directory. (or edit example.cpp so that it doesn't use key-secret file)
  4. Peek into self-documented <your_project_dir>/app/src/example.cpp.
  5. Build example binary
cd <your_project_dir>app/build && cmake .. && make
  1. Run example binary from <your_project_dir>app/bin
./example

How to Build'n'Run src/example.cpp in Docker container

  1. Clone or download bfx-api-cpp repository.
  2. Build docker image
cd <your_project_dir>
docker-compose build
  1. Start docker image
docker-compose up &
  1. Spawn bash
docker exec -it bfx-cpp-api_dev_1 /bin/sh
  1. Add key-secret file in /home/bfx-cpp-api/app/doc directory. (or edit example.cpp so that it doesn't use key-secret file)
cd /home/bfx-cpp-api/app/doc
echo <key> > key-secret
echo <secret> >> key-secret
  1. Build example
cd /home/bfx-cpp-api/app/build
cmake ..
make
  1. Run example binary
cd /home/bfx-cpp-api/app/bin
./example

Quick interface overview

// Create API client for both authenticated and unauthenticated requests
BfxAPI::BitfinexAPI bfxAPI("accessKey", "secretKey");

// Create API client for just unauthenticated requests
BfxAPI::BitfinexAPI bfxAPI();

// Fetch data
bfxAPI.getTicker("btcusd");

// Check for errors
if (!bfxAPI.hasApiError())
{
    // Get response in string
    cout << bfxAPI.strResponse() << endl;
}
else
{
    // Inspect errors
    cout << bfxAPI.getBfxApiStatusCode() << endl;
    cout << bfxAPI.getCurlStatusCode() << endl;
}

See self-explanatory src/example.cpp for general usage and more requests.

Change Log

  • 2018-09-26 Using the small Docker image Alpine instead of Debian.
  • 2018-09-26 Using docker-compose to build/up/down the image.
  • 2018-09-26 Grouping project files inside the app folder.
  • 2018-08-01 Dockerfile added. CircleCI added.
  • 2018-07-24 CMakeLists.txt added. Installation instructions changed.
  • 2018-07-11 Schema validation logic complete. Client currently validates public requests only.

Known issues

You will not be able to compile bfx-cpp-api with GCC<7.2 due to this bug. You can use CLANG to avoid GCC bug.

Contribution

  1. Fork bfx-cpp-api repository.
  2. Commit to your develop branch.
  3. Create pull request from your develop branch to origin/develop branch.

No direct pull request to master branch accepted!

Author

Petr Javorik www.mmquant.net maple@mmquant.net