33 #include <boost/multi_index/composite_key.hpp>
35 namespace graphene {
namespace market_history {
36 using namespace chain;
48 #ifndef MARKET_HISTORY_SPACE_ID
49 #define MARKET_HISTORY_SPACE_ID 5
67 :base(a),quote(b),
seconds(s),open(o){}
106 int64_t sequence = 0;
116 MARKET_HISTORY_SPACE_ID, order_history_object_type>
139 MARKET_HISTORY_SPACE_ID, market_ticker_object_type>
152 MARKET_HISTORY_SPACE_ID, market_ticker_meta_object_type>
155 bool skip_min_order_his_id =
false;
162 ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
163 ordered_unique< tag<by_key>, member< bucket_object, bucket_key, &bucket_object::key > >
167 struct by_market_time;
171 ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
172 ordered_unique< tag<by_key>, member< order_history_object, history_key, &order_history_object::key > >,
179 member<order_history_object, time_point_sec, &order_history_object::time>,
182 composite_key_compare<
183 std::less< asset_id_type >,
184 std::less< asset_id_type >,
185 std::greater< time_point_sec >,
197 ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
198 ordered_non_unique< tag<by_volume>,
199 member< market_ticker_object, fc::uint128_t, &market_ticker_object::base_volume > >,
204 member<market_ticker_object, asset_id_type, &market_ticker_object::base>,
205 member<market_ticker_object, asset_id_type, &market_ticker_object::quote>
218 MARKET_HISTORY_SPACE_ID, lp_history_object_type>
221 uint64_t sequence = 0;
229 struct by_pool_op_type_seq;
230 struct by_pool_op_type_time;
235 ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
236 ordered_unique< tag<by_pool_seq>,
238 member<liquidity_pool_history_object, liquidity_pool_id_type, &liquidity_pool_history_object::pool>,
239 member<liquidity_pool_history_object, uint64_t, &liquidity_pool_history_object::sequence>
241 composite_key_compare<
242 std::less< liquidity_pool_id_type >,
243 std::greater< uint64_t >
246 ordered_unique< tag<by_pool_time>,
248 member<liquidity_pool_history_object, liquidity_pool_id_type, &liquidity_pool_history_object::pool>,
249 member<liquidity_pool_history_object, time_point_sec, &liquidity_pool_history_object::time>,
250 member<liquidity_pool_history_object, uint64_t, &liquidity_pool_history_object::sequence>
252 composite_key_compare<
253 std::less< liquidity_pool_id_type >,
254 std::greater< time_point_sec >,
255 std::greater< uint64_t >
258 ordered_unique< tag<by_pool_op_type_seq>,
260 member<liquidity_pool_history_object, liquidity_pool_id_type, &liquidity_pool_history_object::pool>,
261 member<liquidity_pool_history_object, int64_t, &liquidity_pool_history_object::op_type>,
262 member<liquidity_pool_history_object, uint64_t, &liquidity_pool_history_object::sequence>
264 composite_key_compare<
265 std::less< liquidity_pool_id_type >,
266 std::less< int64_t >,
267 std::greater< uint64_t >
270 ordered_unique< tag<by_pool_op_type_time>,
272 member<liquidity_pool_history_object, liquidity_pool_id_type, &liquidity_pool_history_object::pool>,
273 member<liquidity_pool_history_object, int64_t, &liquidity_pool_history_object::op_type>,
274 member<liquidity_pool_history_object, time_point_sec, &liquidity_pool_history_object::time>,
275 member<liquidity_pool_history_object, uint64_t, &liquidity_pool_history_object::sequence>
277 composite_key_compare<
278 std::less< liquidity_pool_id_type >,
279 std::less< int64_t >,
280 std::greater< time_point_sec >,
281 std::greater< uint64_t >
292 MARKET_HISTORY_SPACE_ID, lp_ticker_meta_object_type>
295 bool skip_min_lp_his_id =
false;
302 MARKET_HISTORY_SPACE_ID, lp_ticker_object_type>
304 uint32_t _24h_deposit_count = 0;
305 fc::uint128_t _24h_deposit_amount_a = 0;
306 fc::uint128_t _24h_deposit_amount_b = 0;
307 fc::uint128_t _24h_deposit_share_amount = 0;
308 uint32_t _24h_withdrawal_count = 0;
309 fc::uint128_t _24h_withdrawal_amount_a = 0;
310 fc::uint128_t _24h_withdrawal_amount_b = 0;
311 fc::uint128_t _24h_withdrawal_share_amount = 0;
312 fc::uint128_t _24h_withdrawal_fee_a = 0;
313 fc::uint128_t _24h_withdrawal_fee_b = 0;
314 uint32_t _24h_exchange_a2b_count = 0;
315 fc::uint128_t _24h_exchange_a2b_amount_a = 0;
316 fc::uint128_t _24h_exchange_a2b_amount_b = 0;
317 uint32_t _24h_exchange_b2a_count = 0;
318 fc::uint128_t _24h_exchange_b2a_amount_a = 0;
319 fc::uint128_t _24h_exchange_b2a_amount_b = 0;
320 fc::uint128_t _24h_exchange_fee_a = 0;
321 fc::uint128_t _24h_exchange_fee_b = 0;
324 uint64_t total_deposit_count = 0;
325 fc::uint128_t total_deposit_amount_a = 0;
326 fc::uint128_t total_deposit_amount_b = 0;
327 fc::uint128_t total_deposit_share_amount = 0;
328 uint64_t total_withdrawal_count = 0;
329 fc::uint128_t total_withdrawal_amount_a = 0;
330 fc::uint128_t total_withdrawal_amount_b = 0;
331 fc::uint128_t total_withdrawal_share_amount = 0;
332 fc::uint128_t total_withdrawal_fee_a = 0;
333 fc::uint128_t total_withdrawal_fee_b = 0;
334 uint64_t total_exchange_a2b_count = 0;
335 fc::uint128_t total_exchange_a2b_amount_a = 0;
336 fc::uint128_t total_exchange_a2b_amount_b = 0;
337 uint64_t total_exchange_b2a_count = 0;
338 fc::uint128_t total_exchange_b2a_amount_a = 0;
339 fc::uint128_t total_exchange_b2a_amount_b = 0;
340 fc::uint128_t total_exchange_fee_a = 0;
341 fc::uint128_t total_exchange_fee_b = 0;
347 ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >
370 std::string plugin_name()
const override;
371 void plugin_set_program_options(
372 boost::program_options::options_description& cli,
373 boost::program_options::options_description& cfg)
override;
374 void plugin_initialize(
375 const boost::program_options::variables_map& options)
override;
376 void plugin_startup()
override;
378 uint32_t max_history()
const;
379 const flat_set<uint32_t>& tracked_buckets()
const;
380 uint32_t max_order_his_records_per_market()
const;
381 uint32_t max_order_his_seconds_per_market()
const;
384 std::unique_ptr<detail::market_history_plugin_impl> my;
397 (high_base)(high_quote)
398 (low_base)(low_quote)
399 (open_base)(open_quote)
400 (close_base)(close_quote)
401 (base_volume)(quote_volume) )
404 (last_day_base)(last_day_quote)
405 (latest_base)(latest_quote)
406 (base_volume)(quote_volume) )
408 (rolling_min_order_his_id)(skip_min_order_his_id) )
410 (pool)(sequence)(time)(op_type)(op) )
412 (rolling_min_lp_his_id)(skip_min_lp_his_id) )
415 (_24h_deposit_amount_a)
416 (_24h_deposit_amount_b)
417 (_24h_deposit_share_amount)
418 (_24h_withdrawal_count)
419 (_24h_withdrawal_amount_a)
420 (_24h_withdrawal_amount_b)
421 (_24h_withdrawal_share_amount)
422 (_24h_withdrawal_fee_a)
423 (_24h_withdrawal_fee_b)
424 (_24h_exchange_a2b_count)
425 (_24h_exchange_a2b_amount_a)
426 (_24h_exchange_a2b_amount_b)
427 (_24h_exchange_b2a_count)
428 (_24h_exchange_b2a_amount_a)
429 (_24h_exchange_b2a_amount_b)
430 (_24h_exchange_fee_a)
431 (_24h_exchange_fee_b)
432 (_24h_balance_delta_a)
433 (_24h_balance_delta_b)
434 (total_deposit_count)
435 (total_deposit_amount_a)
436 (total_deposit_amount_b)
437 (total_deposit_share_amount)
438 (total_withdrawal_count)
439 (total_withdrawal_amount_a)
440 (total_withdrawal_amount_b)
441 (total_withdrawal_share_amount)
442 (total_withdrawal_fee_a)
443 (total_withdrawal_fee_b)
444 (total_exchange_a2b_count)
445 (total_exchange_a2b_amount_a)
446 (total_exchange_a2b_amount_b)
447 (total_exchange_b2a_count)
448 (total_exchange_b2a_amount_a)
449 (total_exchange_b2a_amount_b)
450 (total_exchange_fee_a)
451 (total_exchange_fee_b)