-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* introduced concept of money and currency * introduced concept of base currency and quote currency * changed model so it queries goxapi's orderbook directly instead of maintaining its own data (for perfomance) * added appropriate unit tests Note: because goxgui does not keep its own order book any more, order grouping and the volume column had to go temporarily
- Loading branch information
Sebastian
committed
May 8, 2013
1 parent
f81286c
commit d6c874b
Showing
13 changed files
with
732 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class Currency(object): | ||
''' | ||
Represents a currency. | ||
''' | ||
|
||
# The amount of decimals is used when rendering the currency. | ||
# Also used to determine the size of a pip. | ||
# All currencies not listed here will have 5 decimals. | ||
__DECIMALS = { | ||
'BTC': 8, | ||
'JPY': 3, | ||
} | ||
|
||
def __init__(self, symbol): | ||
|
||
if symbol in self.__DECIMALS: | ||
self.__decimals = Currency.__DECIMALS[symbol] | ||
else: | ||
self.__decimals = 5 | ||
|
||
self.__symbol = symbol | ||
|
||
def __eq__(self, other): | ||
return self.symbol == other.symbol | ||
|
||
def get_symbol(self): | ||
return self.__symbol | ||
|
||
def get_decimals(self): | ||
return self.__decimals | ||
|
||
def __str__(self): | ||
return self.symbol | ||
|
||
symbol = property(get_symbol, None, None, None) | ||
decimals = property(get_decimals, None, None, None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.