Skip to content

Commit

Permalink
Downgrade from postgres 9.5 dependency by not using 'on conflict do n…
Browse files Browse the repository at this point in the history
…othing' (askmike#1478)

* Downgrade from postgres 9.5 dependency by not using 'on conflict do nothing'
  • Loading branch information
kevinmershon authored and askmike committed Dec 14, 2017
1 parent 0c83b45 commit 079fa33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/commandline/tradebot.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ You can set Gekko up as a tradebot, this will instruct Gekko to:
- Run a strategy (in semi-realtime) over live market data.
- Automatically create buy/sell orders based on signals coming from the strategy.

*As with everything in Gekko, the tradebot will make decisions based on the by YOU selected/configured/created strategy. If you end up losing money you have no one to blame but yourself.*
*As with everything in Gekko, the tradebot will make decisions based on the strategy selected/configured/created **by YOU**. If you end up losing money, you have no one to blame but yourself.*

## Configuration

First set up Gekko for commandline usage (see [this document](./about_the_commandline.md) for details). After that configure the following plugins:
First, set up Gekko for commandline usage (see [this document](./about_the_commandline.md) for details). After that, configure the following plugins:

- `config.watch` - the market to trade on.
- `candleWriter` - (optional) also store market data to disk.
Expand All @@ -19,4 +19,4 @@ First set up Gekko for commandline usage (see [this document](./about_the_comman

Turn off the paperTrader (to not get conflicting profit reports).

Once done run Gekko in live mode.
Once done, run Gekko in live mode.
3 changes: 2 additions & 1 deletion plugins/postgresql/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ Store.prototype.writeCandles = function() {
var stmt = `
INSERT INTO ${postgresUtil.table('candles')}
(start, open, high,low, close, vwp, volume, trades)
values($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT DO NOTHING;
select $1, $2, $3, $4, $5, $6, $7, $8
WHERE NOT EXISTS (select id from ${postgresUtil.table('candles')} where start=$1);
`;

_.each(this.cache, candle => {
Expand Down

0 comments on commit 079fa33

Please sign in to comment.