Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rupurt committed Aug 6, 2021
0 parents commit d5c3750
Show file tree
Hide file tree
Showing 83 changed files with 58,110 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
import_deps: [:ecto, :phoenix],
inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs}"],
subdirectories: ["priv/*/migrations"]
]
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: mix
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: npm
directory: "/assets"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
49 changes: 49 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '40 15 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: test

on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
test:
runs-on: ubuntu-latest
name: Test OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}

strategy:
matrix:
otp: [22.x, 23.x, 24.x]
elixir: [1.12.x]

services:
db:
image: postgres:13.1
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2.3.4

- uses: erlef/setup-beam@v1.8.3
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Cache Dependencies
uses: actions/cache@v2.1.6
with:
path: |
deps
_build/dev
_build/test
key: elixir-cache-${{secrets.CACHE_VERSION}}-${{matrix.elixir}}-otp-${{matrix.otp}}-${{runner.os}}-${{hashFiles('mix.lock')}}-${{hashFiles('assets/package-lock.json')}}-${{github.ref}}
restore-keys: |
elixir-cache-${{secrets.CACHE_VERSION}}-${{matrix.elixir}}-otp-${{matrix.otp}}-${{runner.os}}-${{hashFiles('mix.lock')}}-${{hashFiles('assets/package-lock.json')}}-
elixir-cache-${{secrets.CACHE_VERSION}}-${{matrix.elixir}}-otp-${{matrix.otp}}-${{runner.os}}-
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix setup.deps
- name: Set chromedriver bin path for Wallaby
run: echo "CHROMEDRIVER_BIN_PATH=$CHROMEWEBDRIVER/chromedriver" >> $GITHUB_ENV
- name: Test
env:
MIX_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/prop_?
SECRET_KEY_BASE: ${{secrets.SECRET_KEY_BASE}}
LIVE_VIEW_SIGNING_SALT: ${{secrets.LIVE_VIEW_SIGNING_SALT}}
GUARDIAN_SECRET_KEY: ${{secrets.GUARDIAN_SECRET_KEY}}
run: |
mix tai.gen.migration
mix ecto.create
mix ecto.migrate
mix test
- name: Dialyzer
run: mix dialyzer
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
prop-*.tar

# If NPM crashes, it generates a log, let's ignore it too.
npm-debug.log

# The directory NPM downloads your dependencies sources to.
/assets/node_modules/

# Since we are building assets from assets/,
# we ignore priv/static. You may want to comment
# this depending on your deployment strategy.
/priv/static/
3 changes: 3 additions & 0 deletions .iex.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Application.put_env(:elixir, :ansi_enabled, true)

import Tai.IEx
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Fremantle Industries Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Prop
[![Build Status](https://github.com/fremantle-industries/prop/workflows/test/badge.svg?branch=main)](https://github.com/fremantle-industries/prop/actions?query=workflow%3Atest)
[![hex.pm version](https://img.shields.io/hexpm/v/prop.svg?style=flat)](https://hex.pm/packages/prop)

DeFi? CeFi? TradeFi?

`prop` is an open and opinionated trading platform using productive & familiar
open source libraries and tools for strategy research, execution and operation.

## Install

Add `prop` to your list of dependencies in `mix.exs`

```elixir
def deps do
[
{:prop, "~> 0.0.1"}
]
end
```

## Usage

You can run the app natively on the host `http://prop.localhost:4000`

```bash
$ mix deps.get
$ mix setup
$ mix phx.server
```

Or within `docker-compose` `http://prop.localhost`

```bash
docker-compose up
```

When running the application with `docker-compose` you will need to enter the basic auth development credentials:

```
username: admin
password: password
```

## Requirements

`prop` requires Elixir 1.12+ & Erlang/OTP 22+

## Prop - [http://prop.localhost](http://prop.localhost)

![prop tools](./docs/prop-tools.png)

## Workbench - [http://workbench.localhost](http://workbench.localhost)

From idea to execution, manage your trading operation across a distributed cluster

[![stream-realtime-orders](https://github.com/fremantle-industries/workbench/blob/main/docs/stream-realtime-orders.png)](https://github.com/fremantle-industries/workbench)

## History - [http://history.localhost](http://history.localhost)

Download and warehouse historical trading data

[![history-jobs](https://github.com/fremantle-industries/history/blob/main/docs/predicted-funding-rate-download.png)](https://github.com/fremantle-industries/history)

## Rube - [http://rube.localhost](http://rube.localhost)

A multi-chain DeFi development toolkit

[![rube-poc-overview](https://github.com/fremantle-industries/rube/blob/main/docs/rube-poc-overview-thumbnail.png)](https://youtu.be/f2phGFZrh80)

## Slurpee - [http://slurpee.locahost](http://slurpee.localhost)

A GUI frontend to manage blockchain ingestion with slurp

[![recent heads and blocks](https://github.com/fremantle-industries/slurpee/blob/main/docs/recent-blocks-and-events.png)](https://github.com/fremantle-industries/slurpee)

## Explore Data with LiveBook - [http://livebook.localhost](http://livebook.localhost)

![livebook](./docs/livebook.png)

## Grafana - [http://grafana.localhost](http://grafana.localhost)

![dashboard-beam-vm-health](https://github.com/fremantle-industries/workbench/blob/main/docs/grafana-dashboard-beam-vm-health.png)

## Prometheus - [http://prometheus.localhost](http://prometheus.localhost)

![prometheus](./docs/prometheus.png)

## Tools

* [workbench](https://github.com/fremantle-industries/workbench) - Manage your trading operation across a distributed cluster
* [history](https://github.com/fremantle-industries/history) - Download and warehouse historical trading data
* [tai](https://github.com/fremantle-capital/tai) - Composable, real time, market data and trade execution toolkit
* [rube](https://github.com/fremantle-industries/rube) - A multi-chain DeFi development toolkit for Elixir
* [slurpee](https://github.com/fremantle-industries/slurpee) - A GUI frontend to manage blockchain ingestion with slurp
* [slurp](https://github.com/fremantle-industries/slurp) - Blockchain ingestion toolkit
* [livebook](https://github.com/elixir-nx/livebook) - Livebook is a web application for writing interactive and collaborative code notebooks built with Phoenix LiveView
* [grafana](https://grafana.com) - Dashboard Monitoring. Store & Visualize Your Metrics
* [timescaledb](https://www.timescale.com) - Relational database for time-series data. Supercharged PostgreSQL
* [prometheus](https://prometheus.io) - An open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting

## Authors

- Alex Kwiatkowski - alex+git@fremantle.io

## License

`prop` is released under the [MIT license](./LICENSE.md)
1 change: 1 addition & 0 deletions assets/@types/notified_phoenix.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'notified_phoenix'
1 change: 1 addition & 0 deletions assets/@types/topbar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'topbar'
3 changes: 3 additions & 0 deletions assets/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ["@babel/preset-env"]
};
3 changes: 3 additions & 0 deletions assets/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
42 changes: 42 additions & 0 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// We need to import the CSS so that webpack will load it.
// The MiniCssExtractPlugin is used to separate it out into
// its own CSS file.
import "../css/app.css"

// webpack automatically bundles all modules in your
// entry points. Those entry points can be configured
// in "webpack.config.js".
//
// Import deps with the dep name or local files with a relative path, for example:
//
// import {Socket} from "phoenix"
// import socket from "./socket"
//
import "phoenix_html"
import {Socket} from "phoenix"
import topbar from "topbar"
import {LiveSocket} from "phoenix_live_view"

// Import local files
//
// Local files can be imported directly using relative paths, for example:
// import socket from "./socket"
import {hooks} from "./hooks"

let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}, hooks: hooks})

// Show progress bar on live navigation and form submits
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
window.addEventListener("phx:page-loading-start", () => topbar.show())
window.addEventListener("phx:page-loading-stop", () => topbar.hide())

// connect if there are any LiveViews on the page
liveSocket.connect()

// expose liveSocket on window for web console debug logs and latency simulation:
// >> liveSocket.enableDebug()
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
// >> liveSocket.disableLatencySim()
window.liveSocket = liveSocket

5 changes: 5 additions & 0 deletions assets/js/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {NotifiedPhoenix} from "notified_phoenix"

export const hooks = {
NotifiedPhoenix: NotifiedPhoenix,
}
Loading

0 comments on commit d5c3750

Please sign in to comment.