Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
# Policy for older CMake compatibility in dependencies
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)

project(polymarket_cpp_client VERSION 1.2.5 LANGUAGES CXX C)
project(polymarket_cpp_client VERSION 1.3.0 LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -179,6 +179,10 @@ if(POLYMARKET_CLIENT_BUILD_TESTS)
target_link_libraries(test_order_execution PRIVATE polymarket::client)
add_test(NAME test_order_execution COMMAND test_order_execution)

add_executable(test_order_type_serialization tests/test_order_type_serialization.cpp)
target_link_libraries(test_order_type_serialization PRIVATE polymarket::client)
add_test(NAME test_order_type_serialization COMMAND test_order_type_serialization)

add_executable(test_sdk_error tests/test_sdk_error.cpp)
target_link_libraries(test_sdk_error PRIVATE polymarket::client)
add_test(NAME test_sdk_error COMMAND test_sdk_error)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ include(FetchContent)
FetchContent_Declare(
polymarket_client
GIT_REPOSITORY https://github.com/SebastianBoehler/polymarket-cpp-client.git
GIT_TAG v1.2.5 # or any release tag
GIT_TAG v1.3.0 # or any release tag
)
FetchContent_MakeAvailable(polymarket_client)

Expand All @@ -53,11 +53,11 @@ Download pre-built binaries from [Releases](https://github.com/SebastianBoehler/

```bash
# macOS
curl -LO https://github.com/SebastianBoehler/polymarket-cpp-client/releases/download/v1.2.5/polymarket-cpp-client-macos-arm64.tar.gz
curl -LO https://github.com/SebastianBoehler/polymarket-cpp-client/releases/download/v1.3.0/polymarket-cpp-client-macos-arm64.tar.gz
tar -xzf polymarket-cpp-client-macos-arm64.tar.gz -C /usr/local

# Linux
curl -LO https://github.com/SebastianBoehler/polymarket-cpp-client/releases/download/v1.2.5/polymarket-cpp-client-linux-x64.tar.gz
curl -LO https://github.com/SebastianBoehler/polymarket-cpp-client/releases/download/v1.3.0/polymarket-cpp-client-linux-x64.tar.gz
tar -xzf polymarket-cpp-client-linux-x64.tar.gz -C /usr/local
```

Expand Down
2 changes: 1 addition & 1 deletion include/clob_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace polymarket
GTC, // Good-Til-Cancelled
GTD, // Good-Til-Date
FOK, // Fill-Or-Kill
FAK // Fill-And-Kill (IOC)
FAK // Fill-And-Kill
};

// Order response from API
Expand Down
6 changes: 3 additions & 3 deletions include/polymarket/version.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#define POLYMARKET_CLIENT_VERSION_MAJOR 1
#define POLYMARKET_CLIENT_VERSION_MINOR 2
#define POLYMARKET_CLIENT_VERSION_PATCH 5
#define POLYMARKET_CLIENT_VERSION "1.2.5"
#define POLYMARKET_CLIENT_VERSION_MINOR 3
#define POLYMARKET_CLIENT_VERSION_PATCH 0
#define POLYMARKET_CLIENT_VERSION "1.3.0"

namespace polymarket
{
Expand Down
2 changes: 1 addition & 1 deletion src/clob_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ namespace polymarket
case OrderType::FOK:
return "FOK";
case OrderType::FAK:
return "IOC";
return "FAK";
default:
return "GTC";
}
Expand Down
1 change: 1 addition & 0 deletions tests/test_oracle_watcher_historical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ bool is_transient_rpc_error(const std::string &message)
"Operation timed out",
"request timed out",
"timed out",
"status=403",
};
for (const auto *pattern : patterns)
{
Expand Down
48 changes: 48 additions & 0 deletions tests/test_order_type_serialization.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "http_client.hpp"
#include "order_signer.hpp"
#include "sdk_error.hpp"
#include "types.hpp"

#include <iostream>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>

#define private public
#include "clob_client.hpp"
#undef private

using namespace polymarket;

namespace
{
bool expect_equal(const std::string &name, const std::string &actual, const std::string &expected)
{
if (actual == expected)
{
return true;
}

std::cerr << name << " mismatch\n"
<< " expected: " << expected << "\n"
<< " actual: " << actual << "\n";
return false;
}
}

int main()
{
ClobClient client("https://clob.polymarket.com");

if (!expect_equal("GTC order type", client.order_type_to_string(OrderType::GTC), "GTC") ||
!expect_equal("GTD order type", client.order_type_to_string(OrderType::GTD), "GTD") ||
!expect_equal("FOK order type", client.order_type_to_string(OrderType::FOK), "FOK") ||
!expect_equal("FAK order type", client.order_type_to_string(OrderType::FAK), "FAK"))
{
return 1;
}

return 0;
}
Loading