Chrome 文件 编辑视图 历史记录 书签 个人资料 标签页 ← → M Gmail 1h 29m left © ALL ℗ O 1 M Python Developer 2023 Coding X HI HackerRank Quest

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Chrome 文件 编辑视图 历史记录 书签 个人资料 标签页 ← → M Gmail 1h 29m left © ALL ℗ O 1 M Python Developer 2023 Coding X HI HackerRank Quest

Post by answerhappygod »

 1
1 (181.53 KiB) Viewed 36 times
Chrome 文件 编辑视图 历史记录 书签 个人资料 标签页 ← → M Gmail 1h 29m left © ALL ℗ O 1 M Python Developer 2023 Coding X HI HackerRank Question - Front-F X hackerrank.com/test/75ese4afajd/questions/1b72iktma6j the Calendar G Google drive M SEAS Mail udemy BETA Can't read the text? Switch theme 1. Front-Running Detector 10 帮助 + LeetCode GitHub M work mail Front-running is defined as trading a stock or another financial asset by a broker who has inside knowledge of a future transaction that is about to affect its price substantially. It is illegal and unethical. Example: Here's an example of front-running: Say a trader gets an order from a broker to buy 50,000 shares of Tesla. Such a huge purchase is bound to drive up the price of the stock immediately, at least in the short term. The trader sets aside the broker request for a minute and first buys some Tesla stock for their own portfolio. Then the broker's order is executed. The trader could then immediately sell the Tesla shares and collect a profit. The trader has made a profit based on information that was not public knowledge. Your task is to create a Front-Running Detector that will process option trade data from different exchanges and determine if front-running has occurred. Your solution should be able to handle data from multiple exchanges, with the expectation that additional exchanges will need to be supported in the future. Your implementation should follow good OOP design practices. Given a trade feed, output a list of all (broker_trade_id, electronic_trade_id) pairs. Trade pairs should be ordered by the electronic trade time. A trade pair is considered front-running if all of the following conditions are met: a. One trade is of type "Broker" and the second trade is of type "Electronic". b. The Electronic trade occurs 1 minute or less before the Broker trade. c. Both trades are for the same product. d. Both trades are of the same type (Call/Put). e. Both trades have the same side (Buy/Sell). f. Both trades have the same expiry date. g. Both trades have the same strike price. Note: The incoming trades from CBOE do not have a side field, instead the quantity represents the side. A positive qty represents a buy and negative represents a sell. canvas 5 6 7 8 9 10 11 ++ 163* Scode 12 +4 13 "side"] ▸ class Solution: US ✪ Info Language: Python 3 Autocomplete Ready 1 > import fileinput 3 | 4 # Enter your code here. Read input from STDIN. Print output to STDOUT Cookbook pass Test Results 01 海投网 14 15 16 17 > if __name__ == '__main__':' Q 80 74 13:28 RAW_TRADE_HEADER= ["trade_id", "trade_date", "time_of_trade", "portfolio", "exchange", "product", "product_type", "expiry_dt", "qty", "strike_price", RiverSmall Custom Input def process_raw_trade(self, raw_trade: List): d Loading... Lf) -> List[Tuple[str, str]]: pass * NG23 D ? 0 31 T 亩 (27 3 Col: 1 @一亩三分地
Chrome 文件 编辑视图 历史记录 书签 个人资料 标签页 ● O M Python Developer 2023 Coding X HI HackerRank Question - Front-F X ← → C hackerrank.com/test/75ese4afajd/questions/1b72iktma6j M Gmail udemy + Calendar th+Calendar G Google drive M SEAS Mail supported in the refere, foar implementation and and remon goodoor acaigh practices. Givenra trade feed, output a list of all (broker_trade_id, electronic_trade_id) pairs. Trade pairs should be ordered by the electronic trade time. 1h 29m left Ⓒ ALL ✪ 1 c. Both trades are for the same product. d. Both trades are of the same type (Call/Put). e. Both trades have the same side (Buy/Sell). f. Both trades have the same expiry date. g. Both trades have the same strike price. 10 帮助 + A trade pair is considered front-running if all of the following conditions are met: a. One trade is of type "Broker" and the second trade is of type "Electronic". b. The Electronic trade occurs 1 minute or less before the Broker trade. Output: [('737acm', 'w6c229')] LeetCode GitHub M work mail canvas Note: The incoming trades from CBOE do not have a side field, instead the quantity represents the side. A positive qty represents a buy and negative represents a sell. Example: Trade1: (date='2022-03-15', time-9:01:00, type=Broker, qty=-500, strike=1500, expiry='2022-04- 28', kind=P, exchange=CBOE, trade-id=737acm, product-ABC) Trade2: (date='2022-03-15', time=9:00:24, type=Electronic, qty=-200, strike-1500, expiry='2022- 04-28', kind=P, exchange=CBOE, trade-id=w6c229, product-ABC) Trade3: (date = "2022-03-15', time-9:03:45, type=Electronic, qty=-100, strike-1500, expiry='2022- 04-28', kind=P, exchange=CBOE, trade-id=tssrin, product-ABC) [Fails condition (b)] Trade4: (date='2022-03-15', time-9:00:53, type=Electronic, qty=-500, strike-1500, expiry='2022- 04-28', Kind=P, exchange=CBOE, trade-id = Ik451a, product-XYZ) [Fails condition (c)] Trade5: (date = "2022-03-15', time-9:00:05, type=Electronic, qty=-350, strike-1500, expiry='2022- 04-28', Kind=C, exchange=CBOE, trade-id=9numpr, product-ABC) [Fails condition (d)] Trade6: (date = "2022-03-15', time=9:00:35, type=Electronic, qty=200, strike-1500, expiry='2022-04- 28', Kind-P, exchange=CBOE, trade-id=922v3g, product-ABC) [Fails condition (e)] Trade7: (date='2022-03-15', time=9:00:47, type=Electronic, qty=-150, strike=1500, expiry='2022- 04-21', Kind=P, exchange=CBOE, trade-id = bg54nm, product-ABC) [Fails condition (f)] Trade8: (date = '2022-03-15', time=9:02:23, type=Electronic, qty=-200, strike-1550, expiry='2022- 04-28', Kind=P, exchange=CBOE, trade-id = 6y7fhm, product-ABC) [Fails condition (g)] 5 6 Ⓒ Info Language: Python 3 Autocomplete Ready Ⓒ 1 > import fileinput 3 4 7 8 9 10 11 ++ 163* Scode 12 22 13 14 "side"] ▸ class Solution: 15 16 17 > if US Cookbook pass Test Results 01 #Enter your code here. Read input from STDIN. Print output to STDOUT 海投网 RAW_TRADE_HEADER= ["trade_id", "trade_date", "time_of_trade", "portfolio", "exchange", "product", "product_type", "expiry_dt", "qty", "strike_price", __name__ == '__main____N Q 80 74 13:28 RiverSmall Custom Input def run(self) -> List[Tuple[str, str]]: pass * def process_raw_trade(self, raw_trade: List): NG23 D ? 0 @南三分 31 T
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply