diff --git a/README.md b/README.md index c9a26da..5b94818 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ You can install samaritan from **installation package** or **docker**. +The default username and password are `admin`, please modify them immediately after login! + ### From installation package 1. Download the samaritan installation package on [this page](https://github.com/miaolz123/samaritan/releases) @@ -46,6 +48,26 @@ Then, samaritan is running at `http://localhost:19876`. | okcoin.future | `BTC.WEEK/USD`, `BTC.WEEK2/USD`, `BTC.MONTH3/USD`, `LTC.WEEK/USD`, ... | | oanda.v20 | coming soon ...... | +## Usage + +### Add an Exchange + +![](http://samaritan.stockdb.org/_media/add-exchange.png) + +### Add an Algorithm + +![](http://samaritan.stockdb.org/_media/add-algorithm.png) + +![](http://samaritan.stockdb.org/_media/edit-algorithm.png) + +### Deploy an Algorithm + +![](http://samaritan.stockdb.org/_media/add-trader.png) + +### Run a Trader + +![](http://samaritan.stockdb.org/_media/run-trader.png) + ## Algorithm Reference [Read Documentation](http://samaritan.stockdb.org/#/#algorithm-reference) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5a2abfd..0879138 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,7 +12,7 @@ cd /usr/src/samaritan_linux_amd64/\n\ chmod +x /usr/src/samaritan_linux_amd64/samaritan && \ chmod +x /usr/src/samaritan_linux_amd64/cmd.sh && \ rm -f samaritan_linux_amd64.tar.gz && \ - apt-get purge -y --auto-remove ca-certificates wget + apt-get purge -y --auto-remove wget EXPOSE 9876 diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 51bed3a..c60a5e0 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -17,7 +17,9 @@ cd /usr/src/samaritan_linux_amd64/\n\ chmod +x /usr/src/samaritan_linux_amd64/samaritan && \ chmod +x /usr/src/samaritan_linux_amd64/cmd.sh && \ rm -f samaritan_linux_amd64.tar.gz glibc-2.23-r3.apk /root/.gnupg && \ - apk del .build-deps + apk del .build-deps && \ + apk add --no-cache --virtual ca-certificates && \ + update-ca-certificates EXPOSE 9876 diff --git a/docs/README.md b/docs/README.md index f93b1a9..0f8e926 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,6 +4,8 @@ You can install samaritan from **installation package** or **docker**. +The default username and password are `admin`, please modify them immediately after login! + ### From installation package 1. Download the samaritan installation package on [this page](https://github.com/miaolz123/samaritan/releases) @@ -44,6 +46,26 @@ Then, samaritan is running at `http://localhost:19876`. | okcoin.future | `BTC.WEEK/USD`, `BTC.WEEK2/USD`, `BTC.MONTH3/USD`, `LTC.WEEK/USD`, ... | | oanda.v20 | coming soon ...... | +## Usage + +### Add an Exchange + +![](http://samaritan.stockdb.org/_media/add-exchange.png) + +### Add an Algorithm + +![](http://samaritan.stockdb.org/_media/add-algorithm.png) + +![](http://samaritan.stockdb.org/_media/edit-algorithm.png) + +### Deploy an Algorithm + +![](http://samaritan.stockdb.org/_media/add-trader.png) + +### Run a Trader + +![](http://samaritan.stockdb.org/_media/run-trader.png) + # Algorithm Reference ## Protocols diff --git a/docs/_media/add-algorithm.png b/docs/_media/add-algorithm.png new file mode 100644 index 0000000..3349f6c Binary files /dev/null and b/docs/_media/add-algorithm.png differ diff --git a/docs/_media/add-exchange.png b/docs/_media/add-exchange.png new file mode 100644 index 0000000..80b8079 Binary files /dev/null and b/docs/_media/add-exchange.png differ diff --git a/docs/_media/add-trader.png b/docs/_media/add-trader.png new file mode 100644 index 0000000..3a8c78d Binary files /dev/null and b/docs/_media/add-trader.png differ diff --git a/docs/_media/edit-algorithm.png b/docs/_media/edit-algorithm.png new file mode 100644 index 0000000..60e4fd4 Binary files /dev/null and b/docs/_media/edit-algorithm.png differ diff --git a/docs/_media/run-trader.png b/docs/_media/run-trader.png new file mode 100644 index 0000000..8689d57 Binary files /dev/null and b/docs/_media/run-trader.png differ diff --git a/web/src/containers/Algorithm.js b/web/src/containers/Algorithm.js index c3d3042..b3cce95 100644 --- a/web/src/containers/Algorithm.js +++ b/web/src/containers/Algorithm.js @@ -4,7 +4,7 @@ import { ExchangeList } from '../actions/exchange'; import { TraderList, TraderPut, TraderDelete, TraderSwitch, TraderCache } from '../actions/trader'; import React from 'react'; import { connect } from 'react-redux'; -import { browserHistory } from 'react-router'; +import { Link, browserHistory } from 'react-router'; import { Badge, Button, Dropdown, Form, Input, Menu, Modal, Select, Table, Tag, Tooltip, notification } from 'antd'; const FormItem = Form.Item; @@ -223,6 +223,16 @@ function main() { } const { traderInfo } = this.state; + + if (!traderInfo.exchanges || traderInfo.exchanges.length < 1) { + notification['error']({ + key: 'algorithmError', + message: 'Error', + description: 'Please add at least one Exchange!', + }); + return; + } + const { dispatch } = this.props; const info = { id: traderInfo.id, @@ -389,7 +399,7 @@ function main() { > diff --git a/web/src/containers/App.js b/web/src/containers/App.js index 952c503..35f2918 100644 --- a/web/src/containers/App.js +++ b/web/src/containers/App.js @@ -62,9 +62,6 @@ class App extends Component { case 'user': browserHistory.push('/user'); break; - case 'docs': - window.location.href = 'http://samaritan.stockdb.org'; - break; case 'logout': Modal.confirm({ title: 'Are you sure to logout ?', @@ -109,7 +106,9 @@ class App extends Component { User - Docs + + Docs + Logout diff --git a/web/src/containers/Login.js b/web/src/containers/Login.js index 235dea2..b725ce9 100644 --- a/web/src/containers/Login.js +++ b/web/src/containers/Login.js @@ -4,7 +4,6 @@ import React from 'react'; import { connect } from 'react-redux'; import { browserHistory } from 'react-router'; import { Button, Form, Input, Icon, Tooltip, notification } from 'antd'; -import { trimEnd } from 'lodash'; class Login extends React.Component { constructor(props) { @@ -77,7 +76,7 @@ class Login extends React.Component { const formItemLayout = { wrapperCol: { offset: 9, span: 6 }, }; - const cluster = localStorage.getItem('cluster') || trimEnd(document.URL, '/login'); + const cluster = localStorage.getItem('cluster') || document.URL.slice(0, -6); return (
600 ? (windowHeight - 500) / 2 : windowHeight > 400 ? (windowHeight - 350) / 2 : 25 }}>