Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cryptifier

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cryptifier - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

1

config/development.json

@@ -18,4 +18,5 @@ {

"carbonEmissionsFutures": {
"ticker": "CFI2Z1",
"increment": 1
}
}

@@ -18,4 +18,5 @@ {

"carbonEmissionsFutures": {
"ticker": "CFI2Z1",
"increment": 1
}
}

2

package.json
{
"name": "cryptifier",
"version": "0.2.0",
"version": "0.2.1",
"main": "./src/app.ts",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/odynvolk/cryptifier",

@@ -10,2 +10,3 @@ # Cryptifier

5. Carbon Emissions Futures from [https://www.investing.com/](https://www.investing.com/)
5. Grayscale Bitcoin Premium from [https://bitbo.io/](https://bitbo.io/)

@@ -12,0 +13,0 @@ Notifies users of price going up or down in increments via...

@@ -6,4 +6,4 @@ // @ts-ignore

import { getCbbi } from "./sources/cbbi";
import { getFearGreedIndex} from "./sources/alternativeMe";
import { getGrayscalePremium} from "./sources/bitbo";
import { getFearGreedIndex } from "./sources/alternativeMe";
import { getGrayscalePremium } from "./sources/bitbo";
import { getRainbow } from "./sources/blockchainCenter";

@@ -15,9 +15,10 @@ import { getTicker } from "./sources/coinGecko";

const currencies = typeof config.currencies === "object" ? config.currencies : JSON.parse(config.currencies);
const CURRENCIES = typeof config.currencies === "object" ? config.currencies : JSON.parse(config.currencies);
const CARBON_EMISSIONS_FUTURES = typeof config.carbonEmissionsFutures === "object" ? config.carbonEmissionsFutures : JSON.parse(config.carbonEmissionsFutures);
const lastFloorPrices = currencies.reduce((acc: any, currency: any) => {
acc[currency.ticker] = 0;
const lastFloorPrices = CURRENCIES.reduce((acc: any, { ticker }: { ticker: string }) => {
acc[ticker] = 0;
return acc;
}, { CFI2Z1: 0 });
}, { [CARBON_EMISSIONS_FUTURES.ticker]: 0 });

@@ -75,8 +76,7 @@ const parseFloorPrice = (price: number, increment: number) => Math.floor((price / increment)) * increment;

const ticker = "CFI2Z1";
const price = parseInt(data);
const priceChange = getPriceChange(ticker, price, config.carbonEmissionsFutures.increment);
const priceChange = getPriceChange(CARBON_EMISSIONS_FUTURES.ticker, price, CARBON_EMISSIONS_FUTURES.increment);
if (priceChange !== PriceChange.NO_CHANGE) {
const text = `Carbon emissions futures are <b>${priceChange}</b>! €${data}`;
return await notifyTelegram(ticker, text);
return await notifyTelegram(CARBON_EMISSIONS_FUTURES.ticker, text);
}

@@ -88,10 +88,8 @@

const runOnce = async () => {
const funcs = currencies.map((currency: any) => getAndNotify(currency.ticker, currency.increment));
funcs.push(getAndNotifyCef());
return await Promise.all(funcs);
const funcs = CURRENCIES.map((currency: any) => getAndNotify(currency.ticker, currency.increment));
return await Promise.all([...funcs, getAndNotifyCef()]);
};
const notifier = async () => {
logger.info(`${currencies.length} currencies defined.`);
logger.info(`${CURRENCIES.length} currencies defined.`);
await runOnce();

@@ -98,0 +96,0 @@

@@ -15,3 +15,2 @@ import axios from "axios";

"Woobull",
"HalvingToPeak",
"GoogleTrends",

@@ -45,3 +44,2 @@ "Confidence",

const result = calculateAverage(data);

@@ -48,0 +46,0 @@ longCache.set("cbbi", result);

@@ -42,6 +42,2 @@ {

},
"HalvingToPeak": {
"1637971200": 0.8321,
"1638057600": 0.8336
},
"GoogleTrends": {

@@ -48,0 +44,0 @@ "1637971200": 0.3097,

@@ -74,3 +74,3 @@ // @ts-ignore

given("CoinGecko API has an updated price above steps", () => {
given("CoinGecko API has an updated price above increments", () => {
nock("https://api.coingecko.com")

@@ -85,3 +85,3 @@ .get("/api/v3/simple/price?ids=bitcoin&vs_currencies=usd")

and("investing.com has an updated price above steps", () => {
and("investing.com has an updated price above increments", () => {
nock("https://www.investing.com")

@@ -88,0 +88,0 @@ .get("/commodities/carbon-emissions-historical-data/")

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc