Skip to content

Commit 943c0d4

Browse files
committed
backup upon finish simulateModels() and saved 3 years dataset.
1 parent 789ec00 commit 943c0d4

11 files changed

+101
-29
lines changed

README.html

+22-2
Large diffs are not rendered by default.

README.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

22
![](www/binary-logo.jpg)
33

4-
# Interview Sample Question
4+
# Job Application - Quantitative Analyst
5+
6+
## Interview Sample Question
57

68
The sample question for Interview a job in Binary options. Here I created a shiny app for the job application.
79

@@ -12,6 +14,8 @@
1214

1315
## Reference
1416

17+
### Question 1
18+
1519
01. [Stock Market Forecasting Using LASSO Linear Regression Model](https://github.com/englianhu/binary.com-interview-question/blob/master/reference/Stock%20Market%20Forecasting%20Using%20LASSO%20Linear%20Regression%20Model.pdf)<img src='www/hot.jpg' width='20'>
1620
02. [Using LASSO from lars (or glmnet) package in R for variable selection](http://stats.stackexchange.com/questions/58531/using-lasso-from-lars-or-glmnet-package-in-r-for-variable-selection?answertab=votes#tab-top)
1721
03. [Difference between glmnet() and cv.glmnet() in R?](Difference between glmnet() and cv.glmnet() in R?)
@@ -28,6 +32,17 @@
2832
14. [Lecture 6 – Stochastic Processes and Monte Carlo](http://zorro-trader.com/manual/en/Lecture%206.htm)
2933
15. [The `caret` Package](http://topepo.github.io/caret/index.html) <img src='www/hot.jpg' width='20'>
3034
16. [Time Series Cross Validation](https://rpubs.com/crossxwill/time-series-cv) <img src='www/hot.jpg' width='20'>
31-
17. [Unicode Math Symbols ∑∞∫π∈ℝ²](http://xahlee.info/comp/unicode_math_operators.html)
35+
17. [Character-Code.com](http://character-code.com/)
3236
18. [Size Matters – Kelly Optimization](https://alphaism.wordpress.com/2012/03/26/size-matters-kelly-optimization/) <img src='www/hot.jpg' width='20'>
3337

38+
### Question 2
39+
40+
1.
41+
2.
42+
43+
### Question 3
44+
45+
01. [Data APIs/feeds available as packages in R](http://stats.stackexchange.com/questions/12670/data-apis-feeds-available-as-packages-in-r)
46+
02.
47+
48+

data/LAD.rds

-62 Bytes
Binary file not shown.

data/LAD_full.rds

60.9 KB
Binary file not shown.

function/simulateModels.R

+14-11
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ LADDT <- LAD %>% data.frame %>% data.frame(Date = rownames(.), .) %>%
3737
# LAD.Volume, 0, format = 'd', big.mark = ','))
3838

3939
dateID0 <- ymd('2015-01-01')
40-
LADDT %<>% filter(Date >= (dateID0 - years(1)))
40+
LADDT %<>% filter(Date >= (dateID0 - years(1))) #dateID == ymd('2016-02-29') has error and will need to review the coding.
4141
dateID <- unique(LADDT$Date)
4242
dateID <- dateID[dateID >= dateID0]
4343
#'@ dir.create(paste0('./data/', str_replace_all(dateID, '-', '')))
4444

4545
## list the cv.glmnet models.
4646
families <- c('gaussian', 'binomial', 'poisson', 'multinomial', 'cox', 'mgaussian', 'all')
4747

48-
gsfit <- llply(dateID, function(dt) {
48+
bsGSfit <- llply(dateID, function(dt) {
4949

5050
## create a folder to save all models.
5151
pth = paste0('./data/', str_replace_all(dt, '-', ''))
@@ -57,19 +57,23 @@ gsfit <- llply(dateID, function(dt) {
5757
yv = c('open1', 'open2', 'high1', 'high2', 'low1', 'low2', 'close1', 'close2', 'daily.mean1', 'daily.mean2', 'daily.mean3', 'mixed1', 'mixed2', 'mixed3'),
5858
pred.type = 'class', .print = TRUE, .save = TRUE, pth = pth)
5959

60+
## basic model weight is FALSE
61+
weight.date = FALSE
62+
weight.volume = FALSE
63+
64+
## save basic or weight models.
6065
if(weight.date != FALSE | weight.volume != FALSE) {
6166
wtfitgaum = gsfit; rm(gsfit)
62-
nam = 'wtfitgaum'
6367

6468
## generates 224 models
6569
saveRDS(wtfitgaum, file = paste0(pth, '/wtfitgaum.rds'))
6670

6771
## saved best mean-squared error comparison.
68-
mse1 = ldply(wtfitgaum$fit, function(x) x$mse) %>% tbl_df %>% filter(mse == min(mse))
72+
wtfitgaum.mse1 = ldply(wtfitgaum$fit, function(x) x$mse) %>% tbl_df %>% filter(mse == min(mse))
6973
saveRDS(wtfitgaum.mse1, file = paste0(pth, '/wtfitgaum.mse1.rds'))
7074

7175
## saved summary of all best models. (if more than 1)
72-
name514gs = unique(mse1$.id)
76+
name514gs = unique(wtfitgaum.mse1$.id)
7377
wtfitgaum.sum = ldply(wtfitgaum$fit[name514gs], function(x) x$mse) %>% tbl_df
7478
saveRDS(wtfitgaum.sum, file = paste0(pth, '/wtfitgaum.sum.rds'))
7579

@@ -78,22 +82,21 @@ gsfit <- llply(dateID, function(dt) {
7882
saveRDS(wtfitgaum.best, file = paste0(pth, '/wtfitgaum.best.rds'))
7983

8084
## saved best model's formula.
81-
wtfitgaum.form = wtfitgaum$formula1[str_replace_all(name514gs, nam, '') %>% as.numeric]
85+
wtfitgaum.form = wtfitgaum$formula1[str_replace_all(name514gs, 'wtfitgaum', '') %>% as.numeric]
8286
saveRDS(wtfitgaum.form, file = paste0(pth, '/wtfitgaum.form.rds'))
8387

8488
} else {
8589
fitgaum = gsfit; rm(gsfit)
86-
nam = 'fitgaum'
8790

8891
## generates 224 models
89-
saveRDS(fitgaum, file = paste0(pth, '/fitgaum'))
92+
saveRDS(fitgaum, file = paste0(pth, '/fitgaum.rds'))
9093

9194
## saved best mean-squared error comparison.
92-
mse1 = ldply(wtfitgaum$fit, function(x) x$mse) %>% tbl_df %>% filter(mse == min(mse))
95+
fitgaum.mse1 = ldply(fitgaum$fit, function(x) x$mse) %>% tbl_df %>% filter(mse == min(mse))
9396
saveRDS(fitgaum.mse1, file = paste0(pth, '/fitgaum.mse1.rds'))
9497

9598
## saved summary of all best models. (if more than 1)
96-
name514gs = unique(mse1$.id)
99+
name514gs = unique(fitgaum.mse1$.id)
97100
fitgaum.sum = ldply(fitgaum$fit[name514gs], function(x) x$mse) %>% tbl_df
98101
saveRDS(fitgaum.sum, file = paste0(pth, '/fitgaum.sum.rds'))
99102

@@ -102,7 +105,7 @@ gsfit <- llply(dateID, function(dt) {
102105
saveRDS(fitgaum.best, file = paste0(pth, '/fitgaum.best.rds'))
103106

104107
## saved best model's formula.
105-
fitgaum.form = fitgaum$formula1[str_replace_all(name514gs, nam, '') %>% as.numeric]
108+
fitgaum.form = fitgaum$formula1[str_replace_all(name514gs, 'fitgaum', '') %>% as.numeric]
106109
saveRDS(fitgaum.form, file = paste0(pth, '/fitgaum.form.rds'))
107110
}
108111
})

ui.R

+48-14
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ ui <- shinyUI(fluidPage(
4444
navbarPage('Shiny App',
4545

4646
tabPanel('Job Discription', h4('Quantitative Analyst at Binary.com'),
47+
p('In Progress...'),
48+
br(),
4749
tags$iframe(src='https://angel.co/binary-com-1/jobs/145277-quantitative-analyst',
4850
height = 800, width = '100%', frameborder = 0)),
4951
#, seamless = 'seamless')), #seamless will hide the scroller.
@@ -52,10 +54,42 @@ ui <- shinyUI(fluidPage(
5254
tabsetPanel(
5355
tabPanel('Questions',
5456
h4('Question Paper'),
55-
p('You are feel free to read the questions below.'),
56-
br(),
57+
p('I used to work in sportsbook industry since couple years ago and tried ,',
58+
'to apply to join binary last year after I resigned from Scott Garden as ',
59+
'a daily trader but due to qualification not yet meet the minimum requirement. ',
60+
'Today I am trying to submit the application with my cv attached with few ',
61+
'technical research and fortunately get reply from the HR which has shortlisted ',
62+
'but request me to answer few questions to test my technical skills on actuarial ',
63+
'and financial trading market modelling. ',
64+
strong('I do appreciate if hired as one among the quantitative analysts and ',
65+
'learning from all experts whom might hold with MSc or phD major in ',
66+
'statistical and couple years experience in hedge fund industry.')),
67+
p('I am just a newbie with couple years working experience in sportsbook industry ',
68+
'and self learning to join the hedge fund indutry from previous baker as a punter. ',
69+
'I like George Soros since year 1998 and used to be clients of ',
70+
tags$a(href='http://www.starlizard.com', target='_blank',
71+
tags$img(height = '20px', alt = 'hot', #align='right',
72+
src = 'sl.jpg')), ' in my first job in sportsbook industry ',
73+
'which was Telebiz AS3388/BetCitics/BetWorks who ',
74+
'accepted billion pounds trading volume as VIP. Besides, I am analysing the bets of ',
75+
tags$a(href='http://www.smartodds.co.uk/', target='_blank',
76+
tags$img(height = '20px', alt = 'hot', #align='right',
77+
src = 'so.jpg')), ' as well.'),
78+
p('I roughly browse over the official website and get to know the binary awarded the ',
79+
'licenses from Japan, UK and Malta. Binary.com is not Scicom otherwise the dummy think of ',
80+
'all business groups are under him will eventually death because there all no any ',
81+
'relationship in real life. If not hired due to ability we can accept and learning but ',
82+
'due to wizard or dummy who think all organizations are under his business will die.'),
83+
tags$a(href='https://www.binary.com/ja/group-history.html', target='_blank',
84+
tags$img(height = '100px', alt = 'hot', #align='right',
85+
src = 'hist02.jpg')),
86+
tags$a(href='https://www.binary.com/ja/group-history.html', target='_blank',
87+
tags$img(height = '100px', alt = 'hot', #align='right',
88+
src = 'hist01.jpg')),
89+
p('You are feel free to read the questions below and answer tabs with an application.'),
90+
br(),
5791
HTML('<iframe src=\"https://raw.githubusercontent.com/englianhu/binary.com-interview-question/ff20ee95aa60ef5cca3cf797066089103eb62acf/reference/quant-analyst-skills-test.pdf" width=\"900\" height=\"600\"></iframe>'),
58-
imageOutput('imp_pdf', width = '100%')),#, height = '500px')),
92+
imageOutput('imp_pdf', width = '100%')), #, height = '500px')),
5993
tabPanel('Q1',
6094
tabsetPanel(
6195
tabPanel('Question',
@@ -89,7 +123,7 @@ ui <- shinyUI(fluidPage(
89123
#'@ choices = c('optKelly', 'optimalF')),
90124
sliderInput('stakes', value = 10000, label = 'Stakes Leverage',
91125
min = 100, max = 1000000, step = 10,
92-
pre = '', animate = TRUE),
126+
pre = 'RMB', animate = TRUE),
93127
actionButton('updatePred', label = 'Update'),
94128
actionButton('tabBut', 'View Table'), style = 'primary'),
95129
bsCollapsePanel('Chart Option',
@@ -167,18 +201,18 @@ ui <- shinyUI(fluidPage(
167201
tags$a(href='http://www.bwinpartypartners.com/index.do?masterben=ryusukekenji', target='_blank',
168202
tags$img(height = '80px', alt='hot', #align='right',
169203
src='BW_Aff_Dashboard_Sample.jpg'))),
170-
tags$li(tags$a(href='https://portal.ladbrokespartners.com/portal/#/login?authfailed=true', target='_blank',
204+
tags$li(tags$a(href='https://portal.ladbrokespartners.com/portal/#/registration?referrer=ryusukekenji', target='_blank',
171205
tags$img(height = '20px', alt='hot', #align='right',
172206
src='LB_Aff.jpg')),
173-
HTML("<a href='https://portal.ladbrokespartners.com/portal/#/login?authfailed=true'>Ladbrokes Partners</a>"),
174-
tags$a(href='http://www.bwinpartypartners.com/index.do?masterben=ryusukekenji', target='_blank',
207+
HTML("<a href='https://portal.ladbrokespartners.com/portal/#/registration?referrer=ryusukekenji'>Ladbrokes Partners</a>"),
208+
tags$a(href='https://portal.ladbrokespartners.com/portal/#/registration?referrer=ryusukekenji', target='_blank',
175209
tags$img(height = '80px', alt='hot', #align='right',
176210
src='LB_Aff_Dashboard_Sample.jpg'))),
177211
tags$li(tags$a(href='http://account.affiliates.williamhill.com/signup.html?a=1598928', target='_blank',
178212
tags$img(height = '20px', alt='hot', #align='right',
179213
src='WH_Aff.jpg')),
180214
HTML("<a href='http://account.affiliates.williamhill.com/signup.html?a=1598928'>Affiliates William Hill</a>"),
181-
tags$a(href='http://www.bwinpartypartners.com/index.do?masterben=ryusukekenji', target='_blank',
215+
tags$a(href='http://account.affiliates.williamhill.com/signup.html?a=1598928', target='_blank',
182216
tags$img(height = '80px', alt='hot', #align='right',
183217
src='WH_Aff_Dashboard_Sample.jpg'))))),
184218
p('I have conducting few research and development in sportsbook betting and learning Western since year 2007 I resigned from ',
@@ -337,7 +371,7 @@ ui <- shinyUI(fluidPage(
337371
br(),
338372
br(),
339373
h4('4. Profit & Loss'),
340-
p(''),
374+
p('In progress...'),
341375
br(),
342376
br(),
343377
hr('5. MCMC'),
@@ -350,7 +384,7 @@ ui <- shinyUI(fluidPage(
350384
'Above articles brief the formula of RSI 14 days and SMA 50, 100, 200 days. ',
351385
'Again, I don\'t pretend to know the true data size and the weighted parameters, ',
352386
'here I try to apply the MCMC (Markov Chain Monte Carlo) to get the optimal return from investment.'),
353-
p(),
387+
p('In progress...'),
354388
br(),
355389
br(),
356390
hr('6. Future Works'),
@@ -393,7 +427,7 @@ ui <- shinyUI(fluidPage(
393427
must walk away with zero, and you must do so having placed a non-zero bet on every game. How do you
394428
place your bets?')),
395429
tabPanel('Answer',
396-
p('')))))),
430+
p('In progress...')))))),
397431

398432
tabPanel('Appendix',
399433
tabsetPanel(
@@ -433,9 +467,9 @@ ui <- shinyUI(fluidPage(
433467
tags$a(href='https://github.com/scibrokes/owner', target='_blank',
434468
tags$img(height = '20px', alt='hot', #align='right',
435469
src='hot.jpg'))),
436-
p('17. ', HTML("<a href='http://xahlee.info/comp/unicode_math_operators.html'>Unicode Math Symbols ∑∞∫π∈ℝ²</a>")),
437-
p('18. ', HTML("<a href='https://alphaism.wordpress.com/2012/03/26/size-matters-kelly-optimization/'>Size Matters Kelly Optimization</a>"),
438-
tags$a(href='https://github.com/scibrokes/owner', target='_blank',
470+
p('17. ', HTML("<a href='http://character-code.com/'>Character-Code.com</a>")),
471+
p('18. ', HTML("<a href='https://alphaism.wordpress.com/2012/03/26/size-matters-kelly-optimization/'>Size Matters - Kelly Optimization</a>"),
472+
tags$a(href='https://github.com/scibrokes/owner', target='_blank',
439473
tags$img(height = '20px', alt='hot', #align='right',
440474
src='hot.jpg')))),
441475

www/LB_Aff_Dashboard_Sample.jpg

31.9 KB
Loading

www/hist01.jpg

82.4 KB
Loading

www/hist02.jpg

97.2 KB
Loading

www/sl.jpg

10.3 KB
Loading

www/so.jpg

10.7 KB
Loading

0 commit comments

Comments
 (0)