SlideShare a Scribd company logo
1 of 30
Trading at market
speed
with the latest
KAFKA features
Íñigo González Ponce
@exocert
• Didn’t like databases, stats
• Very critical about so-called ‘big-data’
stacks. Tell me why later.
• Sysadmin for more than 20 years.
• Data & ML Product @One2One
• Data Science Awards 2016: Best data
Engineer.Íñigo González
@exocert
$> whoami
Disclaimer
•VERY HIGH RISK
• Don’t risk money you cannot
afford to loose.
• You’ll be trading high volatility
markets. Easily manipulated, too.
• Software bugs might make you
loose money.
6/6Inversión de muy alto riesgo.
Ud. Puede perder hasta la camisa por un
error en su código o por situaciones que
están fuera de su control.
Tenga miedito. Es más seguro.
This talk reflect my views and opinion, not my employer’s.
Automated trading (late 80’s)
The ability of trading in a market without continuous human
intervention.
You need:
Something that watches the market
Something able to execute orders based on your instructions.
High Frecuency trading
Automated trading
At milisecond speed
Able to trade multiple exchanges at once
*VERY* expensive to do:
Software licenses for CEPs started at $10,000
for cpu core.
Now it’s different
HOW to make money
trading cryptocurrencies?
(if you don’t have too many bugs)
Meet the
orderbook
The orderbook
The
orderbook is a
queue
Think about a queue in a staircase.
Every step is a bid/ask Price
On every step you can have one or more orders in
a queue.
ORDERS are executed on a FIRST-COME-FIRST-
SERVE basis.
Orderbook
and Liquidity
There is a STRONG incentive to be early in the
orderbook…
… because you’re the first in the line to execute
your orders.
BTW: Some markets have 0% trading fee for
market MAKERS.
Strategy
•Be early in the orderbook: send
orders ASAP.
•Be a Market maker (low/0% fees)
HOW?
Kafka
Kafka streams
KSQL
Use case :
Shotgun order
Orderbook inside a Kafka topic
=
Orderbook from topic to stream
CHANGE DATATYPES (tricky with arrays)
select price, sum(amount) from ob_USDBTC group by price ;
Finally see if the orderbook spot is occupied
• Make a Price_Candidates topics
• Put there the prices you might want to trade.
• I mean, the prices your _automated_ strategy believes it’s ok to trade.
• Join that with the data values you have in the orderbook.
• Those are the prices you DO NOT want to trade
• Why? because someone else has an order there.
create table xUSDBTC (price varchar, amount double, count double) with
(KEY='price', kafka_topic=‘ob_USDBTC', value_format='json’);
Create stream do_not_trade_here as 
select x.Price from xUSDBTC x 
left join Price_candidates pc on x.Price = pc.Price ;
The big picture:
What we need in
the real world™
Get
market
data
Store
market
data
Replay
market
data
Test
strategy
Watch
fror entry
signals
Watch for
exit
signals
Execute
trades
Manage
Risk
Predict
orderbok
changes
Thanks! ¡Gracias!
Danke! Obrigado 谢谢
Iñigo Gonzalez
@exocert

More Related Content

Similar to Big data spain 2017 - Iñigo Gonzalez: Trading at market speed with the latest kafka features

#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using GeodePivotalOpenSourceHub
 
Building Wall St Risk Systems with Apache Geode
Building Wall St Risk Systems with Apache GeodeBuilding Wall St Risk Systems with Apache Geode
Building Wall St Risk Systems with Apache GeodeAndre Langevin
 
Data Science and Machine Learning for eCommerce and Retail
Data Science and Machine Learning for eCommerce and RetailData Science and Machine Learning for eCommerce and Retail
Data Science and Machine Learning for eCommerce and RetailAndrei Lopatenko
 
Quant congressusa2011algotradinglast
Quant congressusa2011algotradinglastQuant congressusa2011algotradinglast
Quant congressusa2011algotradinglastTomasz Waszczyk
 
Algorithmic and high-frequency_trading 2011
Algorithmic and high-frequency_trading 2011Algorithmic and high-frequency_trading 2011
Algorithmic and high-frequency_trading 2011jy Torres
 
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...PyData
 
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...Soroush Dalili
 
Episerver commerce 2019 developer meetup
Episerver commerce 2019 developer meetupEpiserver commerce 2019 developer meetup
Episerver commerce 2019 developer meetupScott Reed
 
EXTENT-2015: Prognoz Market Surveillance
EXTENT-2015: Prognoz  Market SurveillanceEXTENT-2015: Prognoz  Market Surveillance
EXTENT-2015: Prognoz Market SurveillanceIosif Itkin
 
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016Quantopian
 
ContentsPhase 1 Design Concepts2Project Description2Use.docx
ContentsPhase 1 Design Concepts2Project Description2Use.docxContentsPhase 1 Design Concepts2Project Description2Use.docx
ContentsPhase 1 Design Concepts2Project Description2Use.docxmaxinesmith73660
 
Marketing Automation Hacks: Marketo
Marketing Automation Hacks: MarketoMarketing Automation Hacks: Marketo
Marketing Automation Hacks: MarketoUberflip
 
Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.jhugg
 
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019Niels Basjes
 
AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...
AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...
AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...Amazon Web Services
 
[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...
[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...
[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...DataScienceConferenc1
 
Analytic servise BI Datawiz
Analytic servise BI DatawizAnalytic servise BI Datawiz
Analytic servise BI DatawizDatawiz.io
 
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital EnterpriseWSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital EnterpriseWSO2
 

Similar to Big data spain 2017 - Iñigo Gonzalez: Trading at market speed with the latest kafka features (20)

Automated Trading
Automated TradingAutomated Trading
Automated Trading
 
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
 
Building Wall St Risk Systems with Apache Geode
Building Wall St Risk Systems with Apache GeodeBuilding Wall St Risk Systems with Apache Geode
Building Wall St Risk Systems with Apache Geode
 
Data Science and Machine Learning for eCommerce and Retail
Data Science and Machine Learning for eCommerce and RetailData Science and Machine Learning for eCommerce and Retail
Data Science and Machine Learning for eCommerce and Retail
 
Quant congressusa2011algotradinglast
Quant congressusa2011algotradinglastQuant congressusa2011algotradinglast
Quant congressusa2011algotradinglast
 
Algorithmic and high-frequency_trading 2011
Algorithmic and high-frequency_trading 2011Algorithmic and high-frequency_trading 2011
Algorithmic and high-frequency_trading 2011
 
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...
Brains & Brawn: the Logic and Implementation of a Redesigned Advertising Mark...
 
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
How to win big - Several Interesting Examples of Exploiting Financial & Gambl...
 
Episerver commerce 2019 developer meetup
Episerver commerce 2019 developer meetupEpiserver commerce 2019 developer meetup
Episerver commerce 2019 developer meetup
 
presentation slides
presentation slidespresentation slides
presentation slides
 
EXTENT-2015: Prognoz Market Surveillance
EXTENT-2015: Prognoz  Market SurveillanceEXTENT-2015: Prognoz  Market Surveillance
EXTENT-2015: Prognoz Market Surveillance
 
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
 
ContentsPhase 1 Design Concepts2Project Description2Use.docx
ContentsPhase 1 Design Concepts2Project Description2Use.docxContentsPhase 1 Design Concepts2Project Description2Use.docx
ContentsPhase 1 Design Concepts2Project Description2Use.docx
 
Marketing Automation Hacks: Marketo
Marketing Automation Hacks: MarketoMarketing Automation Hacks: Marketo
Marketing Automation Hacks: Marketo
 
Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.Transactional Streaming: If you can compute it, you can probably stream it.
Transactional Streaming: If you can compute it, you can probably stream it.
 
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
 
AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...
AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...
AWS re:Invent 2016: Learn How FINRA Aligns Billions of Time Ordered Events wi...
 
[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...
[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...
[DSC Europe 23][AICommerce] Ayoub Fakir Critical components for a successful ...
 
Analytic servise BI Datawiz
Analytic servise BI DatawizAnalytic servise BI Datawiz
Analytic servise BI Datawiz
 
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital EnterpriseWSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
 

Recently uploaded

04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad EscortsCall girls in Ahmedabad High profile
 

Recently uploaded (20)

04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
 

Big data spain 2017 - Iñigo Gonzalez: Trading at market speed with the latest kafka features

  • 1. Trading at market speed with the latest KAFKA features Íñigo González Ponce @exocert
  • 2. • Didn’t like databases, stats • Very critical about so-called ‘big-data’ stacks. Tell me why later. • Sysadmin for more than 20 years. • Data & ML Product @One2One • Data Science Awards 2016: Best data Engineer.Íñigo González @exocert $> whoami
  • 3. Disclaimer •VERY HIGH RISK • Don’t risk money you cannot afford to loose. • You’ll be trading high volatility markets. Easily manipulated, too. • Software bugs might make you loose money. 6/6Inversión de muy alto riesgo. Ud. Puede perder hasta la camisa por un error en su código o por situaciones que están fuera de su control. Tenga miedito. Es más seguro. This talk reflect my views and opinion, not my employer’s.
  • 4. Automated trading (late 80’s) The ability of trading in a market without continuous human intervention. You need: Something that watches the market Something able to execute orders based on your instructions.
  • 5. High Frecuency trading Automated trading At milisecond speed Able to trade multiple exchanges at once *VERY* expensive to do: Software licenses for CEPs started at $10,000 for cpu core. Now it’s different
  • 6. HOW to make money trading cryptocurrencies? (if you don’t have too many bugs)
  • 7.
  • 10. The orderbook is a queue Think about a queue in a staircase. Every step is a bid/ask Price On every step you can have one or more orders in a queue. ORDERS are executed on a FIRST-COME-FIRST- SERVE basis.
  • 11. Orderbook and Liquidity There is a STRONG incentive to be early in the orderbook… … because you’re the first in the line to execute your orders. BTW: Some markets have 0% trading fee for market MAKERS.
  • 12. Strategy •Be early in the orderbook: send orders ASAP. •Be a Market maker (low/0% fees)
  • 13. HOW?
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 23.
  • 24. Orderbook inside a Kafka topic =
  • 25. Orderbook from topic to stream
  • 26. CHANGE DATATYPES (tricky with arrays)
  • 27. select price, sum(amount) from ob_USDBTC group by price ;
  • 28. Finally see if the orderbook spot is occupied • Make a Price_Candidates topics • Put there the prices you might want to trade. • I mean, the prices your _automated_ strategy believes it’s ok to trade. • Join that with the data values you have in the orderbook. • Those are the prices you DO NOT want to trade • Why? because someone else has an order there. create table xUSDBTC (price varchar, amount double, count double) with (KEY='price', kafka_topic=‘ob_USDBTC', value_format='json’); Create stream do_not_trade_here as select x.Price from xUSDBTC x left join Price_candidates pc on x.Price = pc.Price ;
  • 29. The big picture: What we need in the real world™ Get market data Store market data Replay market data Test strategy Watch fror entry signals Watch for exit signals Execute trades Manage Risk Predict orderbok changes
  • 30. Thanks! ¡Gracias! Danke! Obrigado 谢谢 Iñigo Gonzalez @exocert