This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dot =: mp =: +/ .* | |
thresholds =: 0 0.12 0.46 0.88 1.5 3 5 10 | |
rates =: 0.06 0.15 0.24 0.35 0.38 0.4 0.42 0.45 | |
marginal_rates =: 2 -~/\ 0, rates | |
tax =: 13 : 'marginal_rates dot 0 >. y - thresholds' | |
sells =: 10 + i. 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NB. https://futurecreator.github.io/2018/10/07/functional-programming-filter-map-fold-reduce/ | |
words =: ',' cutopen 'tony,a,steve,captain,b,thor,hulk,c' | |
filter =: 1 : '(#~ ([: ; u L: 0))' | |
map =: 1 : 'u L: 0' | |
capitalize =: 3 : 0 | |
(}. y) ,~ toupper {. y | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NB. https://www.youtube.com/watch?v=i4VqXRRXi68 | |
NB. https://blogs.mathworks.com/cleve/2017/09/25/how-far-apart-are-two-random-points-in-a-square/ | |
X =: j./ ? 2 1e8 $ 0 | |
Y =: j./ ? 2 1e8 $ 0 | |
dist =: | X - Y | |
mean dist | |
NB. 0.521417 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
min =: |. ;"1 ". each _3 ] \ (TAB, CRLF) cutopen clipread '' | |
col_min =: |: min | |
'date time price' =: col_min | |
is_open =: 905 = time | |
is_open_plus_30 =: 930 = time | |
is_close_minus_60 =: 1430 = time | |
is_close_minus_30 =: 1500 = time | |
is_close =: 1530 = time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grid =: 0&".;._2 (0 : 0) | |
5 3 0 0 7 0 0 0 0 | |
6 0 0 1 9 5 0 0 0 | |
0 9 8 0 0 0 0 6 0 | |
8 0 0 0 6 0 0 0 3 | |
4 0 0 8 0 3 0 0 1 | |
7 0 0 0 2 0 0 0 6 | |
0 6 0 0 0 0 2 8 0 | |
0 0 0 4 1 0 0 0 0 | |
0 0 0 0 0 0 0 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'stats/distribs' | |
require 'numeric' | |
require 'plot' | |
mu =: 0 | |
sigma =: 0.15 | |
n =: 100 | |
days =: +: 365 NB. 2년 | |
dt =: % 365 NB. sigma는 annualized volatility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
correlogram =: 4 : 0 | |
mu =. (+/ % #) x | |
diff =. x - mu | |
num =. (+/ .*)/ (y * 1 _1) }."0 _ diff | |
denum =. (+/ .*)~ diff | |
num % denum | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query =: jd 'read /e time, public_sale, public_purchase, settlement from 069500_TICK order by time' | |
time =: 'time' jdfrom_jd_ query | |
ps =: 'public_sale' jdfrom_jd_ query | |
pp =: 'public_purchase' jdfrom_jd_ query | |
settlement =: 'settlement' jdfrom_jd_ query | |
hour =: 9 + (3600 * 1e9) %~ time - efs_jd_ '2018-07-12 09:00:00' | |
netpp =: +/\ pp - ps | |
pd 'reset' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dist =: +/&.:*:@:-"1 | |
NB. group =: 1 1.1 , 1 1 , 0 0 ,:0 0.1 | |
NB. labels =: 'AABB' | |
kNN =: 4 : 0 | |
'group labels k' =. x | |
labels ({ ~.)~ (i. >./) #/.~ labels {~ k {. /: group dist y | |
) | |
normalize =: (- <./) % (>./ - <./) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NB. Assiciative Array | |
coclass 'aa' | |
get =: ". | |
has =: 0 <: nc@boxopen | |
set =: 4 :'(x)=:y' | |
del =: 4!:55@boxopen | |
NB. following python's convensions | |
keys =: }.@:nl |
NewerOlder