Skip to content

Commit

Permalink
Merge pull request #244 from napse-invest/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Xenepix authored Dec 21, 2023
2 parents a8b0540 + d28b114 commit 2cf09b1
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
2 changes: 2 additions & 0 deletions django_napse/api/fleets/serializers/fleet_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Meta:
"uuid",
"value",
"bot_count",
# write-only
"clusters",
]
read_only_fields = [
"uuid",
Expand Down
6 changes: 5 additions & 1 deletion django_napse/core/models/accounts/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def info(self, verbose=True, beacon=""):
class ExchangeAccount(models.Model, FindableClass):
uuid = models.UUIDField(unique=True, editable=False, default=uuid.uuid4)

exchange = models.ForeignKey("Exchange", on_delete=models.CASCADE, related_name="accounts")
exchange = models.ForeignKey(
"Exchange",
on_delete=models.CASCADE,
related_name="accounts",
)
name = models.CharField(max_length=200)
testing = models.BooleanField(default=True)
description = models.TextField()
Expand Down
50 changes: 50 additions & 0 deletions docs/sources/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Quickstart

!!! warning
Nothing in this documentation constitutes investment advice. This documentation only explains and illustrates how to use the tool. Anything you do with the tool is under your sole responsibility, in accordance with the MIT license.

Once you've followed the [installation instructions](https://napse-invest.github.io/django-napse/#installation), let's take a look at how you can build your own bot.

## Exchange & Exchange Account
---

From the `secrets.json` file, the exchange **BINANCE** and the exchange account with the name **Binance EA_NAME** have been automatically built.

However, if you want to build another exchange or another exchange account, let's take a look at how to do it.

```python
from django_napse.core.models import Exchange, ExchangeAccount

# Create an exchange
exchange = Exchange.objects.create(
name="BINANCE",
description="...",
)
exchange_account = ExchangeAccount.objects.create(
exchange=exchange,
testing=True,
name="ea name",
description="...",
)
```

## Space
---

Let's build a space. A space is a place to categorize and manage your money.
```python
from django_napse.core.models import NapseSpace
space = NapseSpace.objects.create(
name="Space",
description="Space description",
exchange_account=exchange_account,
)
```

## Fleet
---

Then it's time to build a fleet. A fleet is a set of bot. This allows bots to be scaled up according to the amount of money they manage.
```python

```
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extra:
link: https://discord.com/invite/47gKBreSXa
name: Discord
- icon: fontawesome/brands/github
link: https://github.com/napse-invest/Napse
link: https://github.com/napse-invest/
name: Github

theme:
Expand Down Expand Up @@ -150,6 +150,7 @@ markdown_extensions:
nav:
- Home:
- Overview: "index.md"
- Quickstart: "sources/quickstart.md"
- How to guides:
- "sources/guides/exchange.md"
- "sources/guides/exchange_account.md"
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ target-version = "py311"

[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
max-complexity = 10

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 60

0 comments on commit 2cf09b1

Please sign in to comment.