Skip to content

Commit

Permalink
sell simulation service
Browse files Browse the repository at this point in the history
Signed-off-by: MarcoMandar <malicemandar@gmail.com>
  • Loading branch information
MarcoMandar committed Nov 25, 2024
1 parent ea0984f commit 0b029c0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/plugin-solana/src/providers/simulationSellingService.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
TrustScoreDatabase,
TokenPerformance,
TradePerformance,
TokenRecommendation,
// TradePerformance,
// TokenRecommendation,
ProcessedTokenData,
} from "@ai16z/plugin-trustdb";
import { Connection, PublicKey } from "@solana/web3.js";
// Assuming TokenProvider and IAgentRuntime are available
import { TokenProvider } from "./token.ts";
import { settings } from "@ai16z/eliza";
// import { settings } from "@ai16z/eliza";
import { IAgentRuntime, Memory, Provider, State } from "@ai16z/eliza";

Check failure on line 12 in packages/plugin-solana/src/providers/simulationSellingService.ts

View workflow job for this annotation

GitHub Actions / check

'Memory' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 12 in packages/plugin-solana/src/providers/simulationSellingService.ts

View workflow job for this annotation

GitHub Actions / check

'Provider' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 12 in packages/plugin-solana/src/providers/simulationSellingService.ts

View workflow job for this annotation

GitHub Actions / check

'State' is defined but never used. Allowed unused vars must match /^_/u
import { WalletProvider } from "./wallet.ts";
import * as amqp from "amqplib";
Expand All @@ -31,6 +31,7 @@ export class simulationSellingService {
private amqpChannel: amqp.Channel;
private sonarBe: string;
private sonarBeToken: string;
private runtime: IAgentRuntime;

private runningProcesses: Set<string> = new Set();

Expand All @@ -55,6 +56,7 @@ export class simulationSellingService {
this.initializeRabbitMQ(runtime.getSetting("AMQP_URL"));
this.sonarBe = runtime.getSetting("SONAR_BE");
this.sonarBeToken = runtime.getSetting("SONAR_BE_TOKEN");
this.runtime = runtime;
}
/**
* Initializes the RabbitMQ connection and starts consuming messages.
Expand Down Expand Up @@ -143,7 +145,8 @@ export class simulationSellingService {
const sellTimeStamp = new Date().toISOString();
const tokenProvider = new TokenProvider(
tokenAddress,
this.walletProvider
this.walletProvider,
this.runtime.cacheManager
);

// Update sell details in the database
Expand Down Expand Up @@ -201,7 +204,8 @@ export class simulationSellingService {
tokenPerformances.forEach(async (tokenPerformance) => {
const tokenProvider = new TokenProvider(
tokenPerformance.tokenAddress,
this.walletProvider
this.walletProvider,
this.runtime.cacheManager
);
const shouldTrade = await tokenProvider.shouldTradeToken();
if (shouldTrade) {
Expand Down

0 comments on commit 0b029c0

Please sign in to comment.