Sei sulla pagina 1di 7

3.

Problem - Trader for a day - Restrictions


 (/course/inginious-internship-april-2019/csp_money_two)

What is a cryptocurrency token ?

You probably heard about Bitcoin (BTC). Bitcoin is digital money that is not issued or controlled by
anyone. It is used to securely store and transfer any amount of value anywhere in the world. It is used to
buy goods and services, store wealth, or send value to anyone without the permission of a third party.

Besides cryptocurrency coins, like BTC, the crypto space also has tokens, security and utility based ones.
You can see a token as a right to do or claim something, from a vote, a role, to a discount or just a simple
value that represents something in a particular ecosystem, a company.

A utility token gives the owner the right to use the services or network of the company, yet no voting
rights or ownership.

A token is issued by a company in a nite number and o ered to investors in a ICO (Initial Coin O erings)
followed by public sale on crypto exchanges.

What is Caspain (CSP) ?

As a company, Caspian is a joint venture between Tora and Kenetic


to provide an institutional grade crypto trading platform.

From a token perspective, Caspian (CSP) is a utility token that allows


or o ers a discount when using the Caspian trading platform.

Caspian issued 400m CSPs which can be traded only with ETH
(Ethereum).

The funds from CSP sale are invested in di erent areas:

Trading concepts
Position

Suppose you buy 1 CSP. It means you have a position of 1 CSP (you own 1 CSP). When you sell that 1 CSP,
you liquidated your position, you have no more CSP.
Exposure

When having a position on any asset or currency (like CSP) you are exposed to the price uctuations of
that currency or asset. Having a high exposure means your risk of loss is higher in case of price volatility.

Trading restrictions and regulations

Each transaction done by a trader (eg. buy 1 CSP) must meet the trading regulations at exchange level.
Meaning that you can buy or sell taking into account the rules imposed by the exchange.

Brokerage fee

Crypto exchanges or brokers can impose some execution fees, so that they earn some money from the
amount you trade. For example an exchange can impose a 1 RON commision on each CSP bought.

Task
Let's see what is like to be a trader for a while. You can now buy or sell Caspian (CSP) but only using
Ethereum (ETH). Can you pro t from 2 exchange rates in your trading strategy ?

You are given an initial sum of money, a starting position on each of the 2 currencies and arrays of prices
of those currencies for multiple days. Your task is to design a trading strategy to maximize your amount
of money after those days (pro t) taking into account some restrictions.

Restrictions:
you can buy or sell CSP only using ETH but not RON.
you can trade (buy or sell) at most p% of your position in CSP in a day
each transaction in CSP has a fee (an exchange commision) attached to it.
You must have RON for paying the fees in order to make the transaction

Problem description
You start with a sum of money in RON - S (S >= 0), a position on ETH - PETH (PETH >= 0), a position on
CSP - PCSP (PCSP >= 0) and a restriction for position in CSP in a day - Tp% (on each day you can buy or
sell max Tp% * PCSP)

Given a number of days - D, prices on each day for ETH (ETH->RON) - CiETHRON and CSP (ETH -> CSP) -
CiETHCSP, the fees for buy FeeBUY and sell FeeSELL, the sum of money in RON available in day D
(Stotal) is calculated as the amount of money available in RON in day D (after commisions) plus the
money obtained by liquidating any open position on ETH and CSP in day D.

Example:

Given:
S=1000 // initial sum of money in RON
PETH=200 // initial position in ETH - amount of ETH held
PCSP=100 // initial position in CSP - amount of CSP held
D=10 // number of days
Tp%=30% // max % to sell/buy from your position of CSP in a day
FeeBUY=2 // fee in RON for buying CSP - 1 CSP bought = 2 RON paid besides th
FeeSELL=1 // fee in RON for selling CSP - 1 CSP sold = 1 RON paid besides th
CiETHRON=12 15 11 4 28 50 27 31 16 7 // price of ETH on each day (ETH
CiETHCSP=10 5 15 11 18 20 27 31 26 7 // price of CSP on each day (ETH->

A possible trading strategy (but not the best) could be to:


day 1: buy 30CSP then sell 20ETH => PCSP=130, PETH=177, RON=1180
day 2: sell 20CSP then buy 30ETH => PCSP=110, PETH=211, RON=710
=> Stotal = 710 + (110 / 7 (eth from csp) + 211 (eth in the pocket)) * 7(eth to ron price) = 710 +
(15+211) * 7 = 710 + 1582 = 2292 RON - NO FEES PAID ON LAST DAY

CiETHRON=12 15 11 4 28 50 27 31 16 7 // price of ETH on each day


CiETHCSP=10 5 15 11 18 20 27 31 26 7 // price of CSP on each day

steps:
day1: 30C -20E // buy 30CSP and then sell 20ETH
day2: -20c 30e // sell 20CSP and then buy 30ETH
day3: 0
day4: 0
day5: 0
day6: 0
day7: 0
day8: 0
day9: 0
day10: 0

Input data set


The input data (scenario - sum of money, position and prices) is provided as a data set le - a plain text
le containing numbers with the following format:

File format

First line: N =<scenarios> : the number of scenarios contained in that le


Next lines: N scenarios
each such scenario has data on multiple lines:
line 1: a new line
line 2: S =<sum of money>
line 3: PETH =<position in ETH>
line 4: PCSP =<position in CSP>
line 5: D =<days>
line 6: Tp% =<restriction>%
line 7: FeeBUY% = commision in RON for buying CSP
line 8: FeeSELL% = commision in RON for selling CSP
line 9: CiETHRON =[prices for ETH -> RON separated by space]
line 10: CiETHCSP =[prices for ETH -> CSP separated by space]
Example

N=2

S=1000
PETH=200
PCSP=100
D=10
Tp%=30%
FeeBUY=2
FeeSELL=1
CiETHRON=12 15 11 4 28 50 27 31 16 7
CiETHCSP=10 5 15 11 18 20 27 31 26 7

S=1000
PETH=200
PCSP=100
D=10
Tp%=100%
FeeBUY=1
FeeSELL=1
CiETHRON=1 1 1 1 1 1 1 1 1 1
CiETHCSP=10 12 15 11 18 20 27 31 26 7

Submissions
Each trading strategy for corresponding scenarios must be submitted in a submission le (.out), with the
following format:

File format
each scenario should have D lines and scenarios are separated by new line
within a scenario, all transactions from a line i correspond to day i
each transaction from a line has a speci c format: <value>[E|C]
value >= 0 => buy, value < 0 => sell
E: ETH, using CiETHRON (ETH->RON) prices and PETH position
C: CSP, using CiETHCSP (ETH->CSP) prices and PCSP position

30C -20E // day 1 => buy 30 CSP then sell 20 ETH


-20c 30e // day 2 => sell 20 CSP then buy 30 ETH
0 // day 3
0 // day 4
0 // day 5
0 // day 6
0 // day 7
0 // day 8
0 // day 9
0 // day 10

Example

Given the input le:


example_v3.in (csp_money_three/example_v3.in)

N=2

S=1000
PETH=200
PCSP=100
D=10
Tp%=30%
FeeBUY=2
FeeSELL=1
CiETHRON=12 15 11 4 28 50 27 31 16 7
CiETHCSP=10 5 15 11 18 20 27 31 26 7

S=1000
PETH=200
PCSP=100
D=10
Tp%=100%
FeeBUY=1
FeeSELL=1
CiETHRON=1 1 1 1 1 1 1 1 1 1
CiETHCSP=10 12 15 11 18 20 27 31 26 7

The corresponding output le should have the following format:

30C -20E
-20c 30e
0
0
0
0
0
0
0
0

100C
0
0
0
0
0
0
0
0
0

Validation

In order for the submission to be accepted, it must follow the above format requirements. In case any
invalid actions are detected on any scenario, no score will be computed for that submission.
Scoring

The provided .out le is used by a simulator to apply the trading strategy given a scenario.

The score of a submission represents the points resulted from pro ts accross all scenarios from
input_v3.in le.

The pro t is transformed into points using formula:

1000 RON profit = 1 point

For each scenario the pro t represents a di erence between the sum of money from day D (Stotal) and
sum of initial money (both S and money obtained by liquidating the initial positions on ETH and CSP).

Source code

Choose File No le chosen

Max le size: 2.0MB


Allowed extensions: .txt, .java, .php, .c, .cpp, .py, .rb, .go, .zip, .gz, .tar.gz, .tar.bz2

Results

Input le:

input_v3.in (csp_money_three/input_v3.in)
Output le:

Choose File No le chosen

Max le size: 2.5MB


Allowed extensions: .out

Submit

Information
Author(s) Tora

Deadline 31/12/9999 23:59:59

Status Not yet attempted

Grade 0.0

Grading weight 1.0

Attempts 0
Submission limit 40 submissions
every 1 hour(s)

Submitting as
   Cuc Gabriel Paul

   Teams management
(/aggregation/inginious-internship-april-
2019)

For evaluation
 Best submission

 No submission

Submission history
No submission

Potrebbero piacerti anche