找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1997|回复: 5
收起左侧

[Goldman Sachs] 高盛设计题面经

[复制链接]

1204

主题

184

精华

3716

积分

神级会员

Rank: 7Rank: 7Rank: 7

积分
3716
发表于 10-5-2017 08:54 AM | 显示全部楼层 |阅读模式

亲!马上注册或者登录会查看更多内容!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

We tend to use computer to solve practical problems that actually earns or save dollars. Here is something that happens across the stock exchanges : people buy and sell stocks.- j9 s2 M0 Q8 i w% X
We generally use automated intelligent systems to buy and sell stocks. That part is too much mathematics, and beyond scope of this interview. There is another part. Suppose the system issues a buy order : buy 1000 Microsoft stock. Now, there are more than 1 ( in fact 10 ) active exchanges from where we can buy MSFT. There is a slight price delta, which keeps changing over time. There is another problem. In each stock exchange, prices are stacked, that is : + W4 k0 k; `+ f/ a: k
1. For first 100 stocks prices are 55$. 8 u4 u) }( M2 ^; c% g
2. Next 200 stocks, prices are 55.2$. 9 x+ {% P5 K* @; f8 T# W- W0 l
... etc, and you got the idea. Even this stacks are changing over time. : a1 X; f4 M+ N' |4 M2 U
Thus, here is the problem to solve. Design and implement a system such that one can buy n stocks with minimal price. Q& o# p s! e* k& r3 d* V
Also, in the same spirit, the same system should be able to sell n stocks with maximum payoff possible.& {1 g" _# T4 r& j& z( E$ ~" u
; |' V! m4 x2 A$ z9 |" d, q
This is a non trivial problem, for Quant systems.3 ?6 M1 O7 }6 B; L8 w: o! r' Z
There are always k no of exchanges to hit.

1086

主题

138

精华

3185

积分

神级会员

Rank: 7Rank: 7Rank: 7

积分
3185
发表于 10-5-2017 08:54 AM | 显示全部楼层

We can implement this scenario with an observer pattern. The observed object taking in the number of stocks to be bought. The same object will also maintain a list of observers (the exchanges so to say). As soon as the observed object receives a buy order of say n stocks, it will notify all observers (stock exchanges), which in return will return the best selling price from them. This price can be compared at the observed object's end and the first order can be executed at the exchange offering the best selling (lowest) price. Do this recursively for n number of orders and your entire buy order will be executed at the lowest price. You can perform the same scenario for a sell order of n stocks as well.

回复 支持 反对

使用道具 举报

1195

主题

170

精华

3596

积分

神级会员

Rank: 7Rank: 7Rank: 7

积分
3596
发表于 10-5-2017 08:54 AM | 显示全部楼层

We can implement this scenario with an observer pattern. The observed object taking in the number of stocks to be bought. The same object will also maintain a list of observers (the exchanges so to say). As soon as the observed object receives a buy order of say n stocks, it will notify all observers (stock exchanges), which in return will return the best selling price from them. This price can be compared at the observed object's end and the first order can be executed at the exchange offering the best selling (lowest) price. Do this recursively for n number of orders and your entire buy order will be executed at the lowest price. You can perform the same scenario for a sell order of n stocks as well.

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表