Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Osborn ptim

View GitHub Profile
@ptim
ptim / tradingview-extract-pt-results.js
Created Feb 20, 2021 — forked from marktellez/tradingview-extract-pt-results.js
Extract your tradingview paper trade journal into a csv file
View tradingview-extract-pt-results.js
trs = $($(".paper_trading table.balances")[2]).find(".tv-data-table__tbody tr").map((_, value) => $(value).find("td").map((_, value) => value.innerText))
trades = Object.values(trs.map((_, tr) => [Object.values(tr).slice(0,5)]))
var toTimestamp = val => {
var parts = val.split(' ')
switch(parts[1]) {
case "Minutes":
var d = new Date(new Date().getTime() - (parts[0] * 60 * 60))
break;
case "Hours":
View trade.py
def generate_nonce(length=8):
"""Generate pseudorandom number."""
return ''.join([str(random.randint(0, 9)) for i in range(length)])
def trade(signal,volume,pair):
try:
trade = 'TRADE|OPEN|' + signal + '|' + pair + '|0|0|0|IcarusBot Trade|' + generate_nonce() + '|' + volume
s.send_string(trade, encoding='utf-8')
print("Waiting for metatrader to respond...")
View Readmail.py
def readmail(volume):
time.sleep(1.5)
m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login(user, pwd)
m.select('"[Gmail]/All Mail"')
resp, items = m.search(None,
"NOT SEEN FROM tradingview")
items = items[0].split()
for emailid in items:
resp, data = m.fetch(emailid,
@ptim
ptim / notion_task_manager.py
Created Aug 27, 2020 — forked from jamalex/notion_task_manager.py
Notion task manager toy example
View notion_task_manager.py
import datetime
import random
import time
from multiprocessing import Lock
from notion.client import *
from notion.block import *
mutex = Lock()
@ptim
ptim / aust.json
Created Apr 12, 2020 — forked from GerardoFurtado/aust.json
Australia map
View aust.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ptim
ptim / db-open
Created Feb 22, 2020 — forked from helderco/db-open
Script to open a mysql database in Sequel Pro from a service in docker-compose.
View db-open
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@ptim
ptim / airbus_data.tsv
Created Dec 3, 2019 — forked from atmccann/airbus_data.tsv
Animated path multi-series line chart
View airbus_data.tsv
date Airbus Boeing
2000-07-31 0 0
2000-08-31 -0.884 9.8912
2000-09-29 9.6685 32.1383
2000-10-31 32.5967 38.9245
2000-11-30 33.1492 41.4853
2000-12-29 30.7182 35.2113
2001-01-31 27.0718 19.8464
2001-02-28 24.3094 27.4264
2001-03-30 16.0773 14.1306
@ptim
ptim / CSS-structure.md
Created Aug 3, 2018
Links from a discussion held during the Melb Django Peer to Peer Learning Night on 2018-08-02 at Commoncode
View CSS-structure.md
View keybase.md

Keybase proof

I hereby claim:

  • I am ptim on github.
  • I am ptim (https://keybase.io/ptim) on keybase.
  • I have a public key whose fingerprint is 8E20 8EE9 592E 7398 4BFD 353A A23A 0AB9 2D63 AE7E

To claim this, I am signing this object: