379 lines
8.9 KiB
Markdown
379 lines
8.9 KiB
Markdown
## App Flow Charts
|
|
|
|
### App
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>app.py</b>
|
|
————————————————————————————————
|
|
Initializes the BrighterTrades object, configures the Flask
|
|
server, defines the endpoints then launches the app.
|
|
end legend
|
|
start
|
|
:Create BrighterTrades object;
|
|
:Configure app;
|
|
:Define endpoints;
|
|
:Run app;
|
|
stop
|
|
|
|
|
|
@enduml
|
|
|
|
```
|
|
|
|
### /index
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/index</b>
|
|
————————————————————————————————
|
|
Handles the main landing page, logs in the user,
|
|
ensures a valid connection with an exchange,
|
|
loads dynamic data, and renders the landing page.
|
|
end legend
|
|
start
|
|
:Log in user;
|
|
:Ensure a valid connection with an exchange;
|
|
:Load dynamic data;
|
|
:Render Landing Page;
|
|
stop
|
|
@enduml
|
|
|
|
|
|
|
|
```
|
|
|
|
### /ws
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/ws</b>
|
|
————————————————————————————————
|
|
Handles WebSocket connections, listens for messages,
|
|
processes JSON data, and displays messages.
|
|
end legend
|
|
start
|
|
repeat
|
|
:Listen for message;
|
|
if (Contains JSON?) then (yes)
|
|
:Process received JSON;
|
|
else (no)
|
|
:Display message;
|
|
endif
|
|
repeat while ()
|
|
@enduml
|
|
|
|
```
|
|
|
|
### /settings
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/settings</b>
|
|
————————————————————————————————
|
|
Handles settings changes. If user is logged in,
|
|
processes commands and redirects to index.
|
|
end legend
|
|
start
|
|
if (Logged in?) then (no)
|
|
:redirect -> "/index";
|
|
stop
|
|
else (yes)
|
|
:get_setting();
|
|
:process_command();
|
|
:redirect -> "/index";
|
|
endif
|
|
stop
|
|
@enduml
|
|
|
|
```
|
|
|
|
### /history
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————
|
|
=<b>/history​</b>
|
|
————————————————————————
|
|
Fetches candle history for
|
|
a specific trading pair
|
|
and timeframe. Returns empty
|
|
data if user is not logged in.
|
|
end legend
|
|
start
|
|
if (Logged in?) then (no)
|
|
:Return empty data;
|
|
stop
|
|
else (yes)
|
|
:Get current chart view details;
|
|
:Request price history for the chart view;
|
|
:Return data;
|
|
endif
|
|
stop
|
|
@enduml
|
|
|
|
```
|
|
|
|
### /signup
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/signup</b>
|
|
————————————————————————————————
|
|
Returns the rendered signup page.​
|
|
end legend
|
|
start
|
|
:Return rendered signup page​;
|
|
stop
|
|
@enduml
|
|
|
|
```
|
|
|
|
### /signout
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/signout</b>
|
|
————————————————————————————————
|
|
Logs out the user, deletes the client
|
|
session variable, and redirects to index.
|
|
end legend
|
|
start
|
|
:Logout user;
|
|
:Delete client session var;
|
|
:redirect -> "/index";
|
|
stop
|
|
@enduml
|
|
|
|
|
|
```
|
|
|
|
### /login
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/login</b>
|
|
————————————————————————————————
|
|
Handles user login by receiving credentials,
|
|
logging in the user, and redirecting to index.
|
|
end legend
|
|
start
|
|
:Get credentials;
|
|
:Log in user;
|
|
if (success) then (yes)
|
|
:Set the client session var;
|
|
else (no)
|
|
endif
|
|
:Redirect -> /index;
|
|
stop
|
|
@enduml
|
|
|
|
|
|
```
|
|
|
|
### /signup_submit
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/signup_submit</b>
|
|
————————————————————————————————
|
|
Handles user signup by receiving form data,​
|
|
validating email, creating new user,
|
|
and redirecting to homepage.
|
|
end legend
|
|
start
|
|
:Receive form data;
|
|
:Extract email, username, and password​;
|
|
:Validate email format;
|
|
if (Valid email format?) then (yes)
|
|
:Validate username and password;
|
|
if (Valid username and password?) then (yes)
|
|
:Create new user;
|
|
if (Success) then (yes)
|
|
:Set session user;
|
|
:Redirect to homepage;
|
|
else (no)
|
|
:Flash error message;
|
|
endif
|
|
else (no)
|
|
:Flash error message;
|
|
endif
|
|
else (no)
|
|
:Flash error message;
|
|
endif
|
|
stop
|
|
@enduml
|
|
|
|
```
|
|
|
|
### /indictor_init
|
|
```plantuml
|
|
@startuml
|
|
skinparam legendBackgroundColor lightgreen
|
|
skinparam defaultFontColor blue
|
|
skinparam legendAlignment left
|
|
skinparam defaultFontName "Arial Black"
|
|
skinparam legendFontSize 12
|
|
|
|
skinparam activity {
|
|
BackgroundColor lightblue
|
|
BorderColor black
|
|
FontColor darkblue
|
|
FontSize 16
|
|
}
|
|
|
|
legend top
|
|
————————————————————————————————
|
|
=<b>/indicator_init</b>
|
|
————————————————————————————————
|
|
Initializes the indicators for a given symbol
|
|
and timeframe, retrieves user and chart view​
|
|
details, and returns data response.​
|
|
end legend
|
|
start
|
|
if (Check if username is provided) then (yes)
|
|
:Retrieve username from request data;
|
|
else (no)
|
|
:Return error response;
|
|
stop
|
|
endif
|
|
|
|
if (Check if user is logged in) then (yes)
|
|
:Retrieve chart view for the user;
|
|
else (no)
|
|
:Return error response;
|
|
stop
|
|
endif
|
|
|
|
:Retrieve indicator data for the user;
|
|
:Return data response;
|
|
stop
|
|
@enduml
|
|
|
|
```
|