Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

Commit

Permalink
- add usage docs
Browse files Browse the repository at this point in the history
- add exchange tips to web
- fix docker https
  • Loading branch information
miaolz123 committed Dec 27, 2016
1 parent 7c8dcea commit 88539cf
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 10 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 22 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Binary file added docs/_media/add-algorithm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/add-exchange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/add-trader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/edit-algorithm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/run-trader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions web/src/containers/Algorithm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -389,7 +399,7 @@ function main() {
>
<Select
onSelect={this.handleExchangeChange}
notFoundContent="Please add an exchange at first"
notFoundContent={<Link to="/exchange">Please add an Exchange at first!</Link>}
>
{exchange.list.map((e, i) => <Option key={String(i)} value={String(i)}>{e.name}</Option>)}
</Select>
Expand Down
7 changes: 3 additions & 4 deletions web/src/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?',
Expand Down Expand Up @@ -109,7 +106,9 @@ class App extends Component {
<Icon name="id-card-o" fixedWidth size={collapse ? '2x' : undefined} /><span className="nav-text">User</span>
</Menu.Item>
<Menu.Item key="docs">
<Icon name="book" fixedWidth size={collapse ? '2x' : undefined} /><span className="nav-text">Docs</span>
<a href="http://samaritan.stockdb.org" target='_blank'>
<Icon name="book" fixedWidth size={collapse ? '2x' : undefined} /><span className="nav-text">Docs</span>
</a>
</Menu.Item>
<Menu.Item key="logout">
<Icon name="power-off" fixedWidth size={collapse ? '2x' : undefined} /><span className="nav-text">Logout</span>
Expand Down
3 changes: 1 addition & 2 deletions web/src/containers/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 (
<div style={{ paddingTop: windowHeight > 600 ? (windowHeight - 500) / 2 : windowHeight > 400 ? (windowHeight - 350) / 2 : 25 }}>
Expand Down

0 comments on commit 88539cf

Please sign in to comment.