
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
PROBLEM IN IN PYTHON 3. THIS IS A CODING PROBLEM. NOT A MULTIPLE CHOICE PROBLEM. ANSWER SHOULD BE IN PYTHON. IF YOU DO NOT KNOW HOW TO SOLVE AND THINK IT IS A MULTIPLE CHOICE PROBLEM, DO NOT ANSWER.
class Solution:
"""
RAW_TRADE_HEADER = ["trade_id", "trade_date", "time_of_trade", "portfolio", "exchange", "product", "product_type", "expiry_dt", "qty", "strike_price", "side"]
"""
def process_raw_trade(self, raw_trade: List):
def run(self) -> List[Tuple[str, str]]:
![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)]
Output:
[('737acm', 'w6c229')]
6 days ago](https://content.bartleby.com/qna-images/question/6d1ae07f-bdb5-47a8-9afa-ea5a04bdf9c8/fdf13bc6-25e0-4326-857d-ebc922e77d84/vihaw8_thumbnail.jpeg)
Transcribed Image Text: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)]
Output:
[('737acm', 'w6c229')]
6 days ago

Transcribed Image Text:1. Front-Running Detector
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.
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.
6 days ago
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a C#program that uses a class called ClassRegistration as outlined below: The ClassRegistration class is responsible for keeping track of the student id numbers for students that register for a particular class. Each class has a maximum number of students that it can accommodate. Responsibilities of the ClassRegistration class: It is responsible for storing the student id numbers for a particular class (in an array of integers) It is responsible for adding new student id numbers to this list (returns boolean) It is responsible for checking if a student id is in the list (returns a boolean) It is responsible for getting a list of all students in the class (returns a string). It is responsible for returning the number of students registered for the class (returns an integer) It is responsible for returning the maximum number of students the class is allowed (returns an integer) It is responsible for returning the name of the class. (returns a string) ClassRegistration -…arrow_forwardWritten in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forwardIn the following code: def foo(value): value = value + 1 def main(): x = 10 foo(x) Ox is a formal parameter and value is an actual parameter. O Both value and x are actual parameters. value is a formal parameter and x is an actual parameter. O There are no parameters.arrow_forward
- C++ questionarrow_forwardCreate an object-oriented program that allows you to enter data for customers and employees. Console Customer/Employee Data Entry Customer or employee? (c/e): c DATA ENTRY First name: Frank Last name: Wilson Email: frank44@gmail.com Number: M10293 CUSTOMER Name: Frank Wilson Email: frank44@gmail.com Number: M10293 Continue? (y/n): y Customer or employee? (c/e): e DATA ENTRY First name: joel Last name: murach Email: joel@murach.com SSN: 123-45-6789 EMPLOYEE Name: Joel Murach Email: joel@murach.com SSN: 123-45-6789 Continue? (y/n): n Bye! Specifications ● ● Create a Person class that provides attributes for first name, last name, and email address. This class should provide a property or method that returns the person's full name. Create a Customer class that inherits the Person class. This class should add an attribute for a customer number. Create an Employee class that inherits the Person class. This class should add an attribute for a social security number (SSN). The program should…arrow_forwardThis "Math Skill Builder" programming project will assess a few basic mathematics skills and includes a simple programmed interface to generate three Math skill builder problem sets in the area of arithmetic, geometry and statistics. Although the interface includes statistics, the problem sets are not generated and maybe used for an extra credit portion of this project. The program interface for each Math skill builder set generates four problems in a series that make up the set and uses randomly generated numbers in the range of 1 to 10, stored as double values.arrow_forward
- Written in Python with docstring please if applicable Thank youarrow_forwardIn C++ Create a new project named lab9_1 . You will need to implement a Course class. Here is its UML diagram: Course - department : string- course_num : string- section : int- num_students : int- is_full : bool + Course()+ Course(string, string, int, int)+ setDepartment(string) : void+ setNumber(string) : void+ setSection(int) : void+ setStudents(int) : void+ getDepartment() const : string+ getNumber() const : string+ getSection() const : int+ getStudents() const : int+ print() const : void Create a sample file to read from: CSS 2A 1111 35 Additional information: The Course class has two constructors. Make sure you have default values for your default constructor. Each course maxes out at 40 students. Therefore, you need to make sure that there aren’t more than 40 students in a Course. You can choose how you handle situations where more than 40 students are added. Additionally, you should automatically set is_full to false or true, based on the number of…arrow_forwardImportant requirements for all questions: • All data members must be declared as “private” • No global variable is allowed to be declared and used • Methods within the class and the requested functions cannot have “cin” or “cout” but it should make use of parameters and return value instead. • “cin” and “cout” should be done in main() or any testing functions • Make sure that you clearly show how the C++ class, its methods and all the functions are being called at least twice and print out its return value and its results properly.arrow_forward
- please answer with proper explanation and step by step solution. Question: Program in python: Design a simple class called Dealership, that has two functions: buyCar(Car a) and sellCar(Car a). buyCar(Car a): Adds the car to the list of cars already in the dealership. sellCar(Car a): Removes the car from the list of cars already in the dealership. Note: Implementation of the Car class is not important for this questionarrow_forwardin c++ codearrow_forwardLanguage is C++ Assignment 8 B: Hit Boxes (Part 2). Back in Assignment 2 (so long ago!) we created a simple program to determine what a hit box would be. Now we’re going to use that information to determine if two characters would collide based on those hit boxes.You will create a Player class that takes in the following private attributes (as integers) when creates Width Height X position Y position In addition to Getter methods for all four attributes, the Player class should also have the following methods: MoveHorizontal(int x_delta)◦ Takes in either a negative integer (for moving left) or a positive integer (for moving right). It should update the X position of the Player object MoveVertical(int y_delta)◦ Takes in either a negative integer (for moving down) or a positive integer (for moving up). It should update the Y position of the Player object DidTheyCollide(Player otherPlayer)◦ Takes in another player object, and returns true if they collided with each other (and…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education