Bored of the same old stuff? Ready to shake things up? Well, that's exactly what we're gonna do!
We've got a super cool session lined up for you. It's like a wild experiment where we'll all dive into a brand new programming language from scratch. And the best part? We're keeping the language a secret 'cause that's half the fun! 😉 What we can tell you is that we're gonna have a blast working together, sharing the experience, and learning from each other.
Don't miss out on this crazy ride! Oh, and don't forget to bring your laptop. HackNight = Hands-on hacking madness!
https://tinyurl.com/known-langs
That's it. Earn your pizza slice 🍕
Read the file at data/exchange_rates_usd.json
and create a exchange rate convertes. Notice that rates in the file give the change from USD
to another currencies, and values are not updated with today's prices.
There are two use cases to cover here:
- Convert any currency amount to
USD
. For instance42 AUD
should convert to42/1.3911 = 30.19 USD
. - Convert any currency to another currency, by using
USD
as proxy. For instance42 AUD
converts to(42/1.3911) * (0.8927) = 26.95 EUR
In the folder data
, there's a dataset containinig different payments. We're asking to filter out the list, detecting payments with the following errors:
- Negative amounts (2 points)
- Empty payer name (2 points)
- Not valid credit card format (5 points)
Additionally, we would like you to compute a simple statistic: the top-ten countries with more payments (5 points).
There are different sizes available, we recommend starting with the file having only 100 payments, and then move over the 1 million one, payments-1M.jsonl.gz
.
We'll give 5 extra points to the team processing 1 million payments under a second.
The files are in (json-lines format)[https://jsonlines.org/]. Definitely not the best format, but we want to make the night funny. The structure looks like this:
$ gunzip -c payments-1M.jsonl.gz | head -n 1 | jq
{
"id": "bb652941",
"ean": "90212741",
"amount": 42.85,
"product": "Incredible Plastic Computer",
"vendor": "Walmart",
"currency": "USD",
"payer": {
"name": "Ervin Jast",
"email": "bryant@bednar.example"
},
"credit_card": "564012297698",
"card_type": "solo",
"country": "BL"
}
The Volatility of a stock gives us a measure on the amount of uncertainty given the changes made over time. Normally, it is computed using the standard deviation over the logarithmic returns.
The daily volatility for a given period of returns P
can be defined as:
Therefore, to calculate the volatility for one month, we just have to compute the standard deviation over the returns of that month, having P
trading days:
from math import sqrt
from sample_data import stock_prices
prices = pd.read_csv('./data/prices.csv', index_col=[0,1], parse_dates=[1])
msft = prices.loc['msft'].copy()
time_slice = msft.Close['2016-03-30':'2016-04-29']
std_dev_returns = time_slice.pct_change().std()
trading_days = len(time_slice)
volatility = std_dev_returns * sqrt(trading_days)
This gives us notion on how far the price might deviate from the average, in this case a 8.54%.