Skip to content

Commit 450262f

Browse files
author
ubuntu
committed
update README.md
1 parent 566fc30 commit 450262f

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060

6161

62+
6263
# ccapi
6364
* A header-only C++ library for streaming market data and executing trades directly from cryptocurrency exchanges (i.e. the connections are between your server and the exchange server without anything in-between).
6465
* Bindings for other languages such as Python, Java, C#, Go, and Javascript are provided.
@@ -952,7 +953,8 @@ Bye
952953
#### Handle events in "immediate" vs. "batching" mode
953954

954955
In general there are 2 ways to handle events.
955-
* When a `Session` is instantiated with an `eventHandler` argument, it will handle events in immediate mode. The `processEvent` method in the `eventHandler` will be invoked immediately when an `Event` is available, and the invocation will run on the thread where `boost::asio::io_context` runs. When a `Session` is instantiated with an `eventHandler` and an `eventDispatcher` argument, it will also handle events in immediate mode. The `processEvent` method in the `eventHandler` will also be invoked immediately when an `Event` is available, but the invocation will run in the thread(s) provided by the `eventDispatcher` therefore not blocking the thread where `boost::asio::io_context` runs.
956+
* When a `Session` is instantiated with an `eventHandler` argument, it will handle events in immediate mode. The `processEvent` method in the `eventHandler` will be invoked immediately when an `Event` is available, and the invocation will run on the thread where `boost::asio::io_context` runs. When a `Session` is instantiated with an `eventHandler` and an `eventDispatcher` argument, it will also handle events in immediate mode. The `processEvent` method in the `eventHandler` will also be invoked immediately when an `Event` is available, but the invocation will run in the thread(s) provided by the `eventDispatcher` therefore not blocking the thread where `boost::asio::io_context` runs. `EventHandler`s and/or `EventDispatcher`s can be shared among different sessions. Otherwise, different sessions are independent from each other.
957+
An example can be found [here](example/src/market_data_advanced_subscription/main.cpp).
956958
* When a `Session` is instantiated without an `eventHandler` argument, it will handle events in batching mode. The events will be batched into an internal `Queue<Event>` and can be retrieved by
957959
```
958960
std::vector<Event> eventList = session.getEventQueue().purge();
@@ -961,12 +963,6 @@ An example can be found [here](example/src/market_data_advanced_subscription/mai
961963

962964
#### Thread safety
963965
* The following methods are implemented to be thread-safe: `Session::sendRequest`, `Session::subscribe`, `Session::sendRequestByFix`, `Session::subscribeByFix`, `Session::setTimer`, all public methods in `Queue`.
964-
* The `processEvent` method in the `eventHandler` is invoked on one of the internal threads in the `eventDispatcher`. A default `EventDispatcher` with 1 internal thread will be created if no `eventDispatcher` argument is provided in `Session` instantiation. To dispatch events to multiple threads, instantiate `EventDispatcher` with `numDispatcherThreads` set to be the desired number. `EventHandler`s and/or `EventDispatcher`s can be shared among different sessions. Otherwise, different sessions are independent from each other.
965-
```
966-
EventDispatcher eventDispatcher(2);
967-
Session session(sessionOptions, sessionConfigs, &eventHandler, &eventDispatcher);
968-
```
969-
An example can be found [here](example/src/market_data_advanced_subscription/main.cpp).
970966

971967
#### Enable library logging
972968

0 commit comments

Comments
 (0)