This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy | |
import requests as req | |
import json as js | |
import numpy as np | |
import yfinance as yf | |
import pandas_ta as ta | |
import alpaca_trade_api as tradeapi | |
import nltk | |
from nltk.sentiment.vader import SentimentIntensityAnalyzer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.9; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
contract GirlInHeadphones is ERC721, ERC721URIStorage, Ownable { | |
constructor() ERC721("Girl in headphones", "HGRL") {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Flowers and girl with blue eyes", | |
"description": "Generated with AI girl in a headphones with blue eyes and flowers", | |
"image": "https://fghyhe6q7qbvsba2itll53ytwhebtfyq25f3bh4bx4szwge32lra.arweave.net/KY-Dk9D8A1kEGkTWvu8TscgZlxDXS7Cfgb8lmxib0uI", | |
"edition": 1, | |
"attributes": [ | |
{ "trait_type": "Eye", | |
"value": "blue" | |
}, | |
{ "trait_type": "Sex", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Don't forget to install the library from OpenAI | |
# !pip install openai | |
import os | |
import openai | |
import requests | |
import shutil | |
# SETTINGS | |
DALLE_API_KEY = '[DALL-E 2 API_KEY]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def callback(message: pubsub_v1.subscriber.message.Message): | |
data.append(message) | |
message.ack() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load data from Pub/Sub infrastructure | |
def LoadSub(sub_name): | |
data = [] | |
subscriber = pubsub_v1.SubscriberClient(credentials=credentials) | |
subscription_path = subscriber.subscription_path(PUBSUB_PROJECT_ID, sub_name) | |
def callback(message: pubsub_v1.subscriber.message.Message): | |
data.append(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Publish predictions fot the stock | |
def PublishPredictions(stock, day_1, day_2, day_3): | |
publisher = pubsub_v1.PublisherClient(credentials=credentials) | |
topic_path = publisher.topic_path(PUBSUB_PROJECT_ID, PUBSUB_ORACULAR_TOPIC_ID) | |
data_str = f'{stock}' | |
data = data_str.encode("utf-8") | |
publisher.publish(topic_path, \ | |
data, \ | |
stock=stock, \ | |
day_1=f'{day_1}', \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUBSUB_PROJECT_ID = '[PROJECT ID]' | |
PUBSUB_SCREENER_TOPIC_SUB_ID = 'SharkScreenerTopic-sub' | |
PUBSUB_ORACULAR_TOPIC_SUB_ID = 'SharkOracularTopic-sub' | |
PUBSUB_TIMEOUT = 5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MAIN script | |
def medium_trader_go(request): | |
trader_api = api.REST(TRADER_API_KEY, TRADER_API_SECRET, TRADER_API_URL) | |
account = trader_api.get_account() | |
clock = trader_api.get_clock() | |
if bool(account) == True: | |
message = f'''{TRADER_BOT_NAME}: for *{account.account_number}* | |
current capital is _{account.portfolio_value}$_ | |
and non marginable buying power is _{account.non_marginable_buying_power}$_''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trade with STOP_LOSS and TAKE_PROFIT | |
def Trade(api, stock, operation, shares_to_trade, take_profit, stop_loss): | |
api.submit_order(symbol = stock, qty = shares_to_trade, side = operation, type = 'market', | |
order_class = 'bracket', time_in_force = 'day', | |
take_profit = {'limit_price': take_profit}, | |
stop_loss = {'stop_price': stop_loss}) | |
message = f'\n\t*{stock}*, qty _{shares_to_trade}_ \n\t\twere {operation}' | |
send_message(f'{TRADER_BOT_NAME}: we entered the market with:' + message) | |
return True |