-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e963c9f
commit 7a616e9
Showing
19 changed files
with
109 additions
and
456 deletions.
There are no files selected for viewing
File renamed without changes.
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ForexConfig(AppConfig): | ||
class AssetsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "forex" | ||
name = "assets" |
File renamed without changes.
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
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,63 @@ | ||
from assets.models import Currency, CurrencyPair | ||
|
||
EUR_DATA = {"symbol": "EUR", "name": "Euro", "description": "..."} | ||
|
||
|
||
def create_eur(): | ||
return Currency.objects.create( | ||
symbol="EUR", | ||
name="Euro", | ||
description="Official currency of 20 of the 27 EU nations", | ||
) | ||
|
||
|
||
def create_gbp(): | ||
return Currency.objects.create( | ||
symbol="GBP", | ||
name="Great Britain Pound", | ||
description="Official currency of the United Kingdom", | ||
) | ||
|
||
|
||
def create_jpy(): | ||
return Currency.objects.create( | ||
symbol="JPY", | ||
name="Japanese Yen", | ||
description="Official currency of Japan", | ||
) | ||
|
||
|
||
def create_eurgbp_pair(eur=None, gbp=None): | ||
return CurrencyPair.objects.create( | ||
symbol="EUR/GBP", | ||
name="EUR/GBP Forex Pair", | ||
base_currency=eur or create_eur(), | ||
quote_currency=gbp or create_gbp(), | ||
) | ||
|
||
|
||
def create_eurjpy_pair(eur=None, jpy=None): | ||
return CurrencyPair.objects.create( | ||
name="EUR/JPY Forex Pair", | ||
base_currency=eur or create_eur(), | ||
quote_currency=jpy or create_jpy(), | ||
pip_decimal_position=2, | ||
) | ||
|
||
|
||
def create_gbpjpy_pair(gbp=None, jpy=None): | ||
return CurrencyPair.objects.create( | ||
name="GBP/JPY Forex Pair", | ||
base_currency=gbp or create_gbp(), | ||
quote_currency=jpy or create_jpy(), | ||
pip_decimal_position=2, | ||
) | ||
|
||
|
||
def create_currency_pair_list(): | ||
eur = create_eur() | ||
gbp = create_gbp() | ||
jpy = create_jpy() | ||
create_eurgbp_pair(eur, gbp) | ||
create_eurjpy_pair(eur, jpy) | ||
create_gbpjpy_pair(gbp, jpy) |
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
File renamed without changes.
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
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,14 @@ | ||
from django.urls import path | ||
|
||
from assets import views | ||
|
||
|
||
urlpatterns = [ | ||
# Currency | ||
path("assets/currencies", views.CurrencyListView.as_view(), name="currency-list"), | ||
path("assets/currencies/<int:pk>", views.CurrencyDetailView.as_view(), name="currency-detail"), | ||
|
||
# Currency Pair | ||
path("assets/currency-pairs", views.CurrencyPairListView.as_view(), name="currency-pair-list"), | ||
path("assets/currency-pairs/<int:pk>", views.CurrencyPairDetailView.as_view(), name="currency-pair-detail"), | ||
] |
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
File renamed without changes.
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
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.