Skip to content

Commit

Permalink
Fix examples to use new session init
Browse files Browse the repository at this point in the history
  • Loading branch information
MPogotsky committed Sep 4, 2024
1 parent d6cd695 commit 0eadde5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ project(ExampleApp)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Xapi REQUIRED)

set( SOURCES
main.cpp
)

find_package(Xapi REQUIRED)

add_executable(ExampleApp
${SOURCES}
)
Expand Down
13 changes: 6 additions & 7 deletions examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ boost::asio::awaitable<void> run(boost::asio::io_context &context)
xapi::Stream stream(context);

// Add your credentials here
std::string accountId = "accountId";
std::string password = "password";
std::string host = "ws.xtb.com";
std::string type = "demo";
const std::string accountId = "accountId";
const std::string password = "password";
const std::string accountType = "demo";
bool safe = true;

try
{
co_await socket.initSession(host, type);
co_await socket.initSession(accountType);
auto streamsessionId = co_await socket.login(accountId, password);

co_await stream.initSession(host, type, streamsessionId);
co_await stream.initSession(accountType, streamsessionId);

co_await stream.getBalance();
int counter = 0;
while (counter < 5)
Expand Down
2 changes: 0 additions & 2 deletions xapi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ else()
# LIBRARY SETUP OPTIONS ========================================
include(GNUInstallDirs)

set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Installation Directory" FORCE)

target_include_directories(Xapi
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
Expand Down

0 comments on commit 0eadde5

Please sign in to comment.