Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A Portfolio Management System generates a set of Orders throughout the day that need - to - be traded on a - market. An Order

A Portfolio Management System generates a set of Orders throughout the day that need-to-be traded on a -market. An Order-needs to-be traded within 10-minutes. Each trade has an - associated transaction cost, let's say $1. Design a system that-would minimize the transaction cost by grouping similar Orders.
//2017-07-01-15:00| BUY |100| GOOG
//2017-07-01-15:02| BUY |400| MSFT
//2017-07-01-15:05| SELL |300| GOOG
//2017-07-01-15:11| BUY |500| GS
//2017-07-01-15:11| SELL |100| MSFT
//2017-07-01-15:14| SELL |50| MSFT
//Example Output:
//2017-07-01-15:10| SELL |200| GOOG
//2017-07-01-15:12| BUY |300| MSFT
//2017-07-01-15:21| BUY |500| GS
//2017-07-01-15:24| SELL |50| MSFT
// Total.cost : $4
//2017-07-01-15:00| BUY |400| GOOG
//2017-07-01-15:02| BUY |100| MSFT
//2017-07-01-15:04| BUY |100| MSFT
//2017-07-01-15:08| BUY |200| GS
//2017-07-01-15:12| SELL |200| GOOG
//2017-07-01-15:15| SELL |100| GOOG
//2017-07-01-15:20| BUY |500| GS
//2017-07-01-15:22| SELL |600| GS
//2017-07-01-15:25| BUY |100| MSFT
//Example Output:
//2017-07-01-15:10| BUY |400| GOOG
//2017-07-01-15:12| BUY |200| MSFT
//2017-07-01-15:18| BUY |200| GS
//2017-07-01-15:22| SELL |300| GOOG
//2017-07-01-15:35| SELL |100| MSFT
// Total.cost : $5
Use Python to answer it.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions