Readit News logoReadit News
Scirra_Tom commented on S&P 500 drops 9%, extending losses after 15-minute trading halt   cnbc.com/2020/03/15/trade... · Posted by u/rococode
Scirra_Tom · 5 years ago
Compared to other crashes where there seemed to be an underlying economic issue - this one feels like it will bounce back quickly at some point in my amateur opinion. Am tempted by some 2022 SPY leaps for this reason.
Scirra_Tom commented on Reddit’s profane, greedy traders are shaking up the stock market   bloomberg.com/news/articl... · Posted by u/hashberry
AnotherGoodName · 6 years ago
I have a theory that WSB are so bad at trading that they actually do manipulate stocks due to messing up every automated trading platform that assumes there'd be some logic to the trades being made.

Someone's just bought a $1000 call option on a stock that's currently $400? Automated trading systems will probably raise alerts on that stock since someone must know something for that to happen.

This appeared to happen when WSB were meme-ing on TSLA and a whole bunch of them bought $1000 call options when it was $400. Shortly afterwards TSLA skyrocketed in value.

Scirra_Tom · 6 years ago
> Someone's just bought a $1000 call option on a stock that's currently $400? Automated trading systems will probably raise alerts on that stock since someone must know something for that to happen.

Not an expert but I'd be surprised if one trade like that triggered anything, could easily be a hedge.

Scirra_Tom commented on Your balance is $0.30000000004   medium.com/selency-tech-p... · Posted by u/pimterry
huseyinkeles · 6 years ago
Martin Fowler's money pattern [0] solves this problem. Just make sure whenever you're dealing with currencies to use a value object for money, rather than float. Lots of languages have libraries for this pattern. [1]

[0] - https://www.martinfowler.com/eaaCatalog/money.html

[1] - https://github.com/topics/fowler-money-pattern

Scirra_Tom · 6 years ago
It looks like the amount is stored as an int, which could overflow when dealing with Bitcoin if you're using Satoshi's as a subunit.
Scirra_Tom commented on Your balance is $0.30000000004   medium.com/selency-tech-p... · Posted by u/pimterry
DeedsMoraine · 6 years ago
The smallest unit of US money is the mill or 1/1000 of a dollar. The smallest unit of US currency is the cent. You're supposed to work in mills and round to cents.

Or just work in floats and round as the last step. Or do both selectively depending on which rounding error works in your favor, but don't tell anyone that's what you're doing.

The real problem is that nobody at the company seems to have looked at the parts of their software that everyone sees, so what else have they not looked at?

Scirra_Tom · 6 years ago
I really don't see any need or benefit in storing values as mills unless you're writing forex trading platforms. It's inviting more mistakes.
Scirra_Tom commented on Your balance is $0.30000000004   medium.com/selency-tech-p... · Posted by u/pimterry
dmos62 · 6 years ago
What's the long term benefit?
Scirra_Tom · 6 years ago
Lots of third party implementations will take a few % off your bottom line. That's the main one.

There's a couple of other points here as well:

- If you do enough volume, you're able to negotiate the fee with the payment processor, we've done this successfully. If you outsource, that negotiation is the third parties margin.

- I'm not sure if this is true for third parties, but if they wrap up all your payouts in your native currency (EG GBP£), you lose money on forex. We try our best to have all our EUR and USD sales land in their respective currency accounts, then convert them with low cost services such as transferwise which has saved us a lot of money in the long run.

Saving on your forex and having no third party processor fees, I think in some instances you could be saving in the region of £40,000 to £80,000 per £1mm of sales.

We also couldn't find a third party implementation that would allow us to bill for our product, varied by country, amount, currency AND billing frequency. This fine tuned control can have real benefit, for example we noticed in Ukraine we had high traffic but no sales - by introducing a low monthly UAH billing option we started to grow sales in this region.

Other third party implementations won't handle VAT properly or comprehensively which can create more of an accounting burden, or round VAT transactions unfavourably (size of that benefit is irrelevant to very small obviously depending on volume of transactions!) This gap is being slowly filled from what I've been seeing though.

Using a third party solution for SaaS will always have some level of disconnect, it just feels nicer for the customer when it's all integrated seamlessly. One example being you have full control over branding and distribution of invoices/receipts etc.

Scirra_Tom commented on Your balance is $0.30000000004   medium.com/selency-tech-p... · Posted by u/pimterry
Scirra_Tom · 6 years ago
I'm currently rewriting our store implementation, and it's complicated.

One example is that some currencies have 100 subunits (eg USD), some have 10 subunits (EG TWD/MOP) and some have no subunits (eg JPY). This is made slightly more difficult in that Stripe/Paypal will treat subunits differently, for example Paypal might treat JPY as having 100 subunits and Stripe will treat it with 0 subunits.

You want to be really careful here not to charge 10x/100x more/less to the end customer than you imagine.

Formatting currencies is also something you need to do carefully as dots and commas mean completely different things in various countries and can lead to unexpected charges for customers.

Don't get me started on VAT :P

All worth it in the end though, I enjoy writing this sort of thing and I do see long term benefit to our business that we do it all in-house.

I'd also recommend future proofing implementations to use longs instead of ints for storing money values. Back when Bitcoin was less valuable we allowed BTC as a currency where 1 subunit = 1 satoshi (100,000,000 satoshis in a bitcoin). It was possible to overflow an int this way.

You also can't really write payment systems with the speed you might write other code in your startup - errors and mistakes here could have real impact on peoples lives. For example, loops that create charges that don't end (possible with both Stripe AND Paypal). Loops can manifest themselves as lock collisions as well. Basically, be careful and if speed is important you probably want to outsource it at the expense of some control.

u/Scirra_Tom

KarmaCake day702April 29, 2015View Original