Skip to content

Instantly share code, notes, and snippets.

View pannet1's full-sized avatar

pannet1 pannet1

View GitHub Profile
@pannet1
pannet1 / gist:53773f6e4e67f74311024e1e25f92a10
Created November 16, 2023 16:40
check orders status of norenapi
def order_status(self, **dat):
try:
status_codes = ['COMPLETE', 'REJECTED',
'CANCELED', 'TRIGGER_PENDING']
dat['fn'] = self.order_status
orders = pd.DataFrame(self.obj.get_order_book())
dct_order = orders[orders.norenordno == dat['norenordno']]
entry_order_status = dct_order['status'].values[0]
if dat['txt'] != "ORDER STATUS: ":
dat['txt'] = "ORDER STATUS: "
@pannet1
pannet1 / prediction_market.py
Last active March 21, 2023 23:09
chatgpt prediction market
"""
hi, give me python code for prediction market. rules are below
a) participants bet on two binary pots for an event that is going to happen that day.
b) the bet size changes according to the probability of the event
c) one pot bets 'for' the event and another 'against'
d) if probability of the even if 70% then the for pot bet size is 70$ and against pot bet size is 30$
e) can you interpolate the probability automatically based on the amount collected in each pot and/or based on the number of bets
f) since the bet size is now decided by the prediction class, place_bet will be on the market which inturn will be based on the probability.
g) can you maintain a book for prediction market that collects $1 for every bet from the participants. also maintain book for each participants with an option to make deposits and take withdrawal.
@pannet1
pannet1 / autocomplete.js
Created October 24, 2022 10:47
autocomplete for dealer-web
// Function to do an Ajax call
const searchSymbol = async (keys) => {
const response = await fetch("/mw/"+keys); // Generate the Response object
if (response.ok) {
const jsonValue = await response.json(); // Get JSON value from the response body
return Promise.resolve(jsonValue);
} else {
return Promise.reject("file not found");
}
};
// contents of NIFTY.json
[
17861.5,
17890,
17613.15,
17900
]
@pannet1
pannet1 / trade.py
Last active January 13, 2022 05:08
omsys example
import pyotp
import logging
from kiteext import KiteExt
import pandas as pd
from datetime import datetime as dt
from time import sleep
import json
from msexcel import Msexcel
from omspy.brokers.zerodha import Zerodha
@pannet1
pannet1 / gist:80b64a6e4efd324325f9b9d3b70fbd45
Created April 21, 2021 23:48
making real componentsi with svelte
<script>
// core components
import TableTitle from "components/Cards/TableTitle.svelte";
import TableHead from "components/Cards/TableHead.svelte";
import TableData from "components/Cards/TableData.svelte";
import TableDropdown from "components/Dropdowns/TableDropdown.svelte";
import { onMount } from "svelte";
import { getMemberList } from "../../services/kkk";
let committees
/* private functions */
const millisecs = 100;
// progress indicator
const _show_progress = (Txn, Start, Ltp, Tgt, Stop) => {
let width = 0, rt_txt="Target", lt_txt="Open";
const elem = document.getElementById("bar");
const ptxt = document.getElementById("ptxt");
if( Txn==0) {