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 'dart:convert'; | |
import 'package:flutter/services.dart'; | |
import 'package:flutter_dotenv/flutter_dotenv.dart'; | |
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
import 'package:shared_preferences/shared_preferences.dart'; | |
import 'package:web3dart/web3dart.dart'; | |
import 'package:http/http.dart' as http; | |
import 'package:web_socket_channel/io.dart'; |
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 React, { useReducer, useCallback, useEffect } from "react"; | |
import Web3 from "web3"; | |
import EthContext from "./EthContext"; | |
import { reducer, actions, initialState } from "./state"; | |
function EthProvider({ children }) { | |
const [state, dispatch] = useReducer(reducer, initialState); | |
const init = useCallback( | |
async artifact => { |
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
pragma solidity >=0.4.22 <0.9.0; | |
// pragma experimental ABIEncoderV2; | |
contract RefundByLocation{ | |
struct Employee{ | |
// uint id; | |
string name; | |
address employee_address; | |
} | |
struct Employer{ |
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 combine_get_driver_locations(self, df_trip, df_driver): | |
# df_t = df_trip.copy() | |
driver_lat_ls = [] | |
driver_lng_ls = [] | |
k = 0 | |
for i, df in df_trip.iterrows(): | |
try: | |
trip_id = df['Trip ID'] | |
drivers = df_driver[df_driver['order_id']==trip_id] | |
driver = drivers[drivers['driver_action']=="accepted"] |
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 calculate_speeds(self, starting_time_list, ending_time_list, distance_list): | |
speed_list = [] | |
for i in range(len(starting_time_list)): | |
try: | |
start_datetime_object = datetime.strptime(starting_time_list[i], '%Y-%m-%d %H:%M:%S') | |
end_datetime_object = datetime.strptime(ending_time_list[i], '%Y-%m-%d %H:%M:%S') | |
time_taken = end_datetime_object-start_datetime_object | |
hrs = time_taken.total_seconds()/3600 | |
speed_list.append(distance_list[i]/hrs) | |
except Exception as e: |
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 calculate_distances(self, starting_coordinates, ending_coordinates): | |
calculated_distances = [] | |
for i in range(len(starting_coordinates)): | |
val = str(starting_coordinates[i]).split(',') | |
starting_tuple = (val[0], val[1]) | |
val_end = str(ending_coordinates[i]).split(',') | |
ending_tuple = (val_end[0], val_end[1]) | |
if val_end[0] == "0.0" or val_end[1] == "0.0": | |
calculated_distances.append(-1) | |
elif val_end[0] == "0.5" or val_end[1] == "0.5": |
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 holidays | |
class EDAPipeline(): | |
def __init__(self) -> None: | |
self.ng_holidays = holidays.country_holidays('NG') | |
def isHoliday(self, df_date_str): | |
try: | |
dt = datetime.strptime(df_date_str, '%Y-%m-%d %H:%M:%S').date() |
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 isWeekend(self, df_date_str): | |
# 2021-07-01 07:28:04 | |
datetime_object = datetime.strptime(df_date_str, '%Y-%m-%d %H:%M:%S') | |
# print(datetime_object.weekday()) | |
if datetime_object.weekday() < 5: | |
return 0 | |
else: # 5 Sat, 6 Sun | |
return 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
async function runTest(e){ | |
e.preventDefault() | |
try{ | |
setIsLoading(true) | |
let response = await axios.post(`${BASE_URL}/get_backtest_scene`, { | |
"start_date":startDate, | |
"end_date":endDate, | |
"indicator":selectedindicator, | |
"initial_cash":initCash, | |
"stock":selectedCoin, |
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
CREATE TABLE "User_Table" ( | |
"ID" varchar(PK), | |
"Password" varchar, | |
"Email" varchar, | |
"Subscription_ID" varchar(FK) | |
); | |
CREATE TABLE "Result_Table" ( | |
"ID" varchar(PK), | |
"Back_test_ID" varcahr(FK), |
NewerOlder