from PackageABC.ParentModule import ChildModule
import inspect
print(inspect.getsourcefile(ChildModule))
#which would be in one of these paths
import sys
for p in sys.path:
print(p)
Monday, December 17, 2018
Monday, March 27, 2017
kdb schema idea for market depth from bid ask streams
select lUnixts:last unixts, vwap:siz wavg price, desc price, siz idesc price, siz by unixts, sym from lp where side=`BID
basically, for each timetamp, sym, there's a list of prices, the corresponding list of size, liquidity provider, etc.
see http://code.kx.com/wiki/Cookbook/ProgrammingIdioms#How_do_I_extract_regular-size_vwap_series.3F for explanation
FD whitepapers:
basically, for each timetamp, sym, there's a list of prices, the corresponding list of size, liquidity provider, etc.
see http://code.kx.com/wiki/Cookbook/ProgrammingIdioms#How_do_I_extract_regular-size_vwap_series.3F for explanation
FD whitepapers:
- http://code.kx.com/qref/wp/sample_aggregation_engine_for_market_depth.pdf
- http://code.kx.com/pages/db/DB_Order_Book_a_kdb+_Intra-Day_Storage_and_Access_Methodology.pdf
Sunday, March 26, 2017
How to select the row value associated with the max / min of a column?
http://code.kx.com/wiki/Cookbook/ProgrammingIdioms#How_can_I_extract_the_time_of_the_lowest_and_highest_prices.3F
Thursday, November 3, 2016
one way to pivot table
trade table:
stock side amount
----------------------
`ibm b 100
`ibm s 200
`appl b 300
-- sql server syntax
select stock, sum(iif(side='b', amount, 0)) as b, sum(iif(side='s', amount, 0)) as s
from trade
group by stock;
stock b s
------------------
`ibm 100 200
`aapl 300 0
stock side amount
----------------------
`ibm b 100
`ibm s 200
`appl b 300
-- sql server syntax
select stock, sum(iif(side='b', amount, 0)) as b, sum(iif(side='s', amount, 0)) as s
from trade
group by stock;
stock b s
------------------
`ibm 100 200
`aapl 300 0
Tuesday, November 1, 2016
Column names as parameters to functions
http://code.kx.com/wiki/Cookbook/ProgrammingIdioms#Column_names_as_parameters_to_functions
Wednesday, October 12, 2016
How many times do u expect to roll a die b4 getting two consecutive sixes?
No, it's not 36!
http://www.wikihow.com/Calculate-an-Expected-Value#Calculating_an_Expected_Number_of_Coin_Flips_for_a_Specific_Result_sub
http://www.wikihow.com/Calculate-an-Expected-Value#Calculating_an_Expected_Number_of_Coin_Flips_for_a_Specific_Result_sub
Tuesday, September 27, 2016
Conditional Probability - a visualization
No need to remember the formula. Instead, understand it and u can derive it.
Looking at the diagram above,
- Omega is the entire probability space. [rectangle]
- Event A is a subset of Omega with probability of happening P(A). [left circle]
- Event B is a subset of Omega with probability of happening P(B). [right circle]
- A intersect B is when A and B both happening. [middle ellipsis]
P(B|A) is
- conditional prob of B given A
- ie knowing that A has happened, it is the chance of B happening
What does it really mean?
- knowing that A has happened -> the prob space has shrunk from Omega [rectangle] to P(A) [red circle]
- the chance of B happening left is A intersect B [middle ellipsis]
- note that we don't look at the rest of P(B) [outside of red circle] anymore, since it's outside of the realm of possibility knowing that A has happened.
Picturing the diagram in your mind, you will figure out that
- Given A has happened, chance of B happening is [middle ellipsis] divided by [red circle]
- ie P(B|A) = P(A intersect B) / P(A)
source:
https://courses.edx.org/courses/course-v1:MITx+6.008.1x+3T2016/courseware/1__Probability_and_Inference/conditioning_on_events/
Subscribe to:
Posts (Atom)