Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
This code will fetch all trading pairs in Binance Futures, and generate a file named binance_futures.txt which is ready
to be imported into TradingView as a list of all Binance Futures trading pairs to monitor.
If the snippet is run on Google Colab, it will download the file we wrote to. Please note that as of today 6/12/2022 fetching Binance API
is not possible from Google Colab and so it will fail, this is Binance restricting by Google Colab's IP access.
"""
import requests
"""
References:
- https://developer.twitter.com/en/docs/twitter-api/tweets/counts/quick-start/recent-tweet-counts
- https://developer.twitter.com/en/docs/twitter-api/tweets/counts/introduction
- https://stackoverflow.com/questions/79797/how-to-convert-local-time-string-to-utc
- https://stackoverflow.com/questions/12468823/python-datetime-setting-fixed-hour-and-minute-after-using-strptime-to-get-day
- https://www.folkstalk.com/2022/10/1-day-ago-python-datetime-with-code-examples.html
- https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators
"""
This snippet illustrates the usage of the __call__() magic method, how it can be used to solve a real problem.
Please read code comments for further details.
"""
import asyncio
import binance
from autobahn.asyncio import WebSocketClientProtocol, WebSocketClientFactory
#!/usr/bin/env python3
import argparse
from typing import List
# https://stackoverflow.com/questions/31306951/how-to-sort-a-list-by-last-character-of-string
def last_letter(word):
return word[::-1]
def run(file_paths: List[str], output_path: str, sort=False,reverse=False, quiet=False):
if sort:
@melardev
melardev / build.ps1
Last active September 21, 2021 20:37
param(
[Parameter(Mandatory = $false)][switch]$Linux = $False,
[switch]$Move = $false,
[switch]$Arm = $false,
[switch]$Alpine = $false
)
# Do not forget to replace "app" by the project name
# Example usage:
# - Build for current OS and architecture and move to $GOPATH/bin
# pwsh build.ps1 -Linux -Move
@melardev
melardev / application..yml
Created February 21, 2019 13:55
Spring Cloud Rest App yaml
spring:
application:
name: rest-server
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka
instance:
preferIpAddress: true
@melardev
melardev / RestApplication.java
Created February 21, 2019 13:54
Spring Cloud Rest App
package com.melardev.cloud.rest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class RestApplication {