Files
spark/src/lib/md
..
2019-09-03 13:44:58 -04:00
2019-04-29 16:25:54 -04:00
2019-09-17 16:15:17 -04:00
2019-08-28 18:47:15 -04:00
2018-11-27 13:44:18 -05:00
2019-07-01 15:47:56 -04:00
2019-09-18 09:52:41 -04:00
2019-08-21 18:40:26 -04:00
2017-12-21 16:33:28 -05:00
2019-04-05 17:58:28 -04:00
2017-12-21 16:33:28 -05:00
2019-07-01 15:47:56 -04:00
2017-12-21 16:33:28 -05:00
2017-12-21 16:33:28 -05:00
2019-08-22 12:00:05 -04:00
2018-11-20 16:08:19 -05:00
2018-06-01 17:05:52 -04:00





********************

classes

********************



btscmd md => PlatformLoader



PlatformLoader:

   * Loads the platform specific dll

   * Calls ->start_marketdata() with a full vector<security_info>



SharedList<T> / SharedListWriter

   * Shared memory list object which spans across shared memory segments as necessary

   * O(N) walk

   * atomic add()

   * Single adder / multiple readers

   * no delete

   * Custom header



SecurityIDRecorder

   * add_security(security, lambda callback) -> int     returns security id instantly

   * security_persisted callback when security id is safely persisted



SecurityIndex

   * Platform Implementation helper

   * Maps exhange_id to (ProducerHandle + Data)

   * 



CacheEntry / CacheEntryDepth  (CacheStructure.h)

   * CacheEntry(symbol, depth, # legs) -- size determined in constructor

   * Simple inheritance tree for optional depth

   * Has FixedSecurity

   * Fits in SharedList<T>

   * CRITICAL fields are at the front cache aligned.  bbo/depth. Security goes at the end



   * size, is_public(), is_persisted, is_resolved (spread)

   * statistics like bbo/trade counters

   * is_status_ok

   * bbo, depth, trade, status, open, close



FixedSecurity / FixsdSpreadSecurity

   * Normalized version of our protobuf security

   * Has methods to convert to pb Security

   * Size known at construction w/ # legs - spread legs of type security_key

   * Can use a union for option/future fields



MDProducer(symbol, type)

   * manages lifetime of SharedList instances

   * Hands out MDProducerHandle - entry for one security



MDProducerHandle

   * pointers to shared memory

   * update methods



MDConsumer

   * list of securities

   * find_security_id(symbol, type, etc)

   * get_cache_handle(security id#)

   * Hands out MDCacheHandle

      - if security is null add MDCacheHandle to a list to be updated

        next time securities are polled



MDCacheHandle

   * If security is not present add this is "null"

   * has pointers to relevant shared memory







********************

* Cache Structure

********************



2 Shared memory segment for each  (SYMBOL, TYPE)  - md_hot (bbo,depth,status), md_cold (others)



When a new security is discovered

   1. id is allocated to the security

   2. New CacheEntry is allocated in appropriate arena (is_public=false)

   3. md_cache entry count is incremented

   4. When id is persisted is_public=true, increment version on cache arena