Skip to content

Commit

Permalink
RC 2 / MVP
Browse files Browse the repository at this point in the history
  • Loading branch information
math-a3k committed Jul 29, 2023
1 parent e5cd73e commit 7b3284f
Show file tree
Hide file tree
Showing 49 changed files with 4,330 additions and 960 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
uses: pre-commit/action@v3.0.0

- name: Testing and Coverage
run: pipenv run pytest
run: pipenv run pytest -v
15 changes: 9 additions & 6 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
django = "~=4.2"
django = "*"
django-environ = "*"
pytest-django = "*"
pytest = "*"
Expand All @@ -15,29 +15,32 @@ defusedxml = "*"
requests-mock = "*"
djangorestframework = {git = "https://github.com/encode/django-rest-framework"}
binance-connector = "*"
django-ai = {editable = true, ref = "tradero", git = "https://github.com/math-a3k/django-ai"}
django-nested-admin = "*"
pandas = "*"
psycopg2 = "*"
django-rq = "~=2.6"
django-redis = "*"
django-mathfilters = "*"
rq-scheduler = "*"
daphne = "*"
channels = "*"
channels-redis = "*"
django-websocketclient = "*"
psycopg = {extras = ["binary", "pool"], version = "*"}
statsmodels = "*"
rq = "==1.13"
supervisor = "*"
uwsgi = "*"
time-machine = "*"
encore = "*"
pytest-asyncio = "*"
pytest-xdist = "*"
twisted = {extras = ["http2", "tls"], version = "*"}
drf-spectacular = "*"
asgiref = "*"
asyncio = "*"
django-ai = {editable = true, ref = "tradero", git = "https://github.com/math-a3k/django-ai"}
celery = {extras = ["redis"], version = "*"}
django-celery-results = "*"
django-celery-beat = {file = "https://github.com/celery/django-celery-beat/zipball/master"}
python-crontab = "*"
pytest-celery = "*"

[dev-packages]
pre-commit = "*"
Expand Down
1,378 changes: 746 additions & 632 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ tradero

``tradero`` is a tool for achieving self-funding via trading.

Self-funding means generating the means independently to cover a budget in order to opt by the value it produces rather than out of economical neccessity.
Self-funding means generating the means independently to cover a budget in order to opt by the value it produces rather than out of economic necessity (financial freedom).

It tracks Symbols in a `Exchange`_ with a time resolution, calculates indicators and present them in an useful way so the user can perform trading more effectively.
It tracks Symbols in an `Exchange`_ with a time resolution, calculates indicators, presents them in an useful way and provides automatization through trading bots so the user can perform trading more effectively.

The application is available at https://tradero.dev

Expand All @@ -19,7 +19,7 @@ Community
=========

* GitHub: https://github.com/math-a3k/tradero
* Discord: https://discord.gg/zACSJmtP
* Discord: https://discord.gg/6CdZmpjKab
* Mailing list: https://groups.google.com/g/tradero

|
Expand Down
105 changes: 105 additions & 0 deletions base/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
Kline,
OutliersSVC,
Symbol,
TradeHistory,
TraderoBot,
TraderoBotLog,
TrainingData,
User,
WSClient,
Expand All @@ -34,6 +37,7 @@ class TraderoUserAdmin(UserAdmin):
"trading_active",
"date_joined",
"is_staff",
"get_bots",
)
list_display_links = ("username",)
list_filter = ("trading_active",) + UserAdmin.list_filter
Expand All @@ -45,11 +49,17 @@ class TraderoUserAdmin(UserAdmin):
"trading_active",
"api_key",
"api_secret",
"checkpoint",
)
},
),
) + UserAdmin.fieldsets

def get_bots(self, obj):
return obj.bots.count()

get_bots.short_description = "# Bots"


@admin.register(Symbol)
class SymbolAdmin(admin.ModelAdmin):
Expand Down Expand Up @@ -194,3 +204,98 @@ def get_is_open(self, obj):
return obj.is_open

get_is_open.short_description = "Is Open?"


class TradeHistoryInline(admin.StackedInline):
model = TradeHistory
min_num = 3
max_num = 20
extra = 0
ordering = ["-timestamp_start"]
readonly_fields = [
"receipt_buying",
"receipt_selling",
"user",
"symbol",
"timestamp_start",
"timestamp_buying",
"timestamp_selling",
]


@admin.register(TraderoBot)
class TraderoBotAdmin(admin.ModelAdmin):
"""
Admin View for TraderoBot
"""

list_display = (
"id",
"user",
"status",
"symbol",
"should_reinvest",
"should_stop",
"is_dummy",
"strategy",
"strategy_params",
"fund_base_asset",
"fund_quote_asset",
"fund_quote_asset_initial",
"get_last_log_message",
)
list_filter = ("status",)
inlines = [TradeHistoryInline]
readonly_fields = [
"receipt_buying",
"receipt_selling",
"others",
]

def get_last_log_message(self, obj):
return obj.get_last_log_message()

get_last_log_message.short_description = "Last Log Message"


@admin.register(TraderoBotLog)
class TraderoBotLogAdmin(admin.ModelAdmin):
"""
Admin View for TraderoBot
"""

list_display = (
"id",
"bot",
"is_dummy",
"get_action_display",
"message",
)
list_filter = ("action",)

def get_action_display(self, obj):
return obj.get_action_display()

get_action_display.short_description = "Action"


@admin.register(TradeHistory)
class TradeHistoryAdmin(admin.ModelAdmin):
"""
Admin View for TraderoBot
"""

list_display = (
"id",
"user",
"bot",
"is_dummy",
"is_complete",
"variation",
"variation_quote_asset",
"duration_total",
)
list_filter = (
"user",
"bot",
)
Loading

0 comments on commit 7b3284f

Please sign in to comment.