alleyway / add-tradingview-alerts-tool

Automated entry of TradingView alerts for bot trading tools such as 3Commas, Alertatron, CryptoHopper, etc.
MIT License
625 stars 140 forks source link

xpath error after first pair is added #2

Closed Maacus closed 3 years ago

Maacus commented 3 years ago

@mlake Tried in powershell and Ubuntu, same error both times. 1st pair does get correctly generated however.

PS C:\Scratch\alert\add-tradingview-alerts-tool - backup> npm run add-alerts

@alleyway/add-tradingview-alerts-tool@1.0.2 add-alerts tsc && node lib/add-tradingview-alerts.js

Using config file: config.yml Adding symbol: BINANCE:BTCUSDT ( BTC priced in USDT ) TimeoutError: waiting for XPath //*[text()='Continue anyway'] failed: timeout 30000ms exceeded at new WaitTask (C:\Scratch\alert\add-tradingview-alerts-tool - backup\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:411:34) at DOMWorld.waitForXPath (C:\Scratch\alert\add-tradingview-alerts-tool - backup\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:336:26) at Frame.waitForXPath (C:\Scratch\alert\add-tradingview-alerts-tool - backup\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:866:51) at Page.waitForXPath (C:\Scratch\alert\add-tradingview-alerts-tool - backup\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1325:33) at C:\Scratch\alert\add-tradingview-alerts-tool - backup\src\add-tradingview-alerts.ts:31:16 at step (C:\Scratch\alert\add-tradingview-alerts-tool - backup\lib\add-tradingview-alerts.js:33:23) at Object.next (C:\Scratch\alert\add-tradingview-alerts-tool - backup\lib\add-tradingview-alerts.js:14:53) at C:\Scratch\alert\add-tradingview-alerts-tool - backup\lib\add-tradingview-alerts.js:8:71 at new Promise () at __awaiter (C:\Scratch\alert\add-tradingview-alerts-tool - backup\lib\add-tradingview-alerts.js:4:12)

mlake commented 3 years ago

The tool was looking for the "Continue anyway" button which is only shown when adding an alert for an indicator/strategy that gets repainted. I just modified the code to account for this.

Let me know how this works and i will close this issue.

Maacus commented 3 years ago

@mlake Yes that's worked! Thanks a lot, it's really useful by the way and really appreciated. If you were feeling extra awesome, being able to create alert names for each alert would be an amazing feature.

Thanks again Matt

mlake commented 3 years ago

feeling extra awesome

New Release 1.1.0

you can either add a "name" column to your csv or add "name" to your alert config. see the updated example here

Maacus commented 3 years ago

@mlake

Getting a YAML error I'm afraid. Error: <ref 1> YAMLSyntaxError: All collection items must start at the same column at Collection.parse (C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:331:24) at C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:1605:29 at CollectionItem.parse (C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:92:19) at C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:1586:25 at Collection.parse (C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:350:20) at C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:1605:29 at Document.parseContents (C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:622:26) at Document.parse (C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:685:19) at Object.parse (C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\parse-cst.js:1723:18) at parseDocument (C:\Scratch\alert\add-tradingview-alerts-tool-master\node_modules\yaml\dist\index.js:43:24) { source: Collection { error: [Circular 1], range: Range { start: 198, end: 602 }, valueRange: Range { start: 198, end: 602 }, props: [], type: 'MAP', value: null, items: [ [PlainValue], [CollectionItem], [PlainValue], [CollectionItem], [PlainValue], [CollectionItem], [Comment], [PlainValue], [CollectionItem], [FlowCollection], [PlainValue], [PlainValue], [CollectionItem] ], resolved: YAMLMap { items: [Array], schema: undefined, range: [Array], type: 'MAP' } } } (node:10368) YAMLWarning: Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this. (Use node --trace-warnings ... to show where the warning was created) (node:10368) YAMLWarning: Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this. (node:10368) YAMLWarning: Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this. PS C:\Scratch\alert\add-tradingview-alerts-tool-master>

My alert Yaml looks like this now: alert: indicator: CE signal: CE Buy option: Once Per Bar Close

indentation matters! {{quote}} and {{base}} are swapped out for quote asset(eg. USDT) and the base (eg. BTC)

name: {{base}}{{quote}} Buy message: > {"key":"62fa5e3aca2

mlake commented 3 years ago

I think YAML doesn't like the braces, try putting double quotes around your name value, eg:

alert:
  indicator: MTF Deviation
  signal: Tier1 long
  option: Once Per Bar Close
  # alert name is optional - can override in csv if you add a "name" column. can use {{symbol|base|quote}}
  name: "{{base}}{{quote}} Buy"
  # indentation matters! {{quote}} and {{base}} are swapped out for quote asset(eg. USDT) and the base (eg. BTC)
Maacus commented 3 years ago

Yep, that's it. Thanks so much for working on this and going the extra mile with my random requests. I suspect there will be others out there who will really appreciate it too.

If I ever make money out of Crypto, instead of mostly losing it, I'll be sure to remember your ETH address!

Thanks